sachinvirgo
BAN USER
sort the array.
A rough algo can be:-
Now take mid = n/2
if (a[mid] == mid+2 && a[mid-1] = mid)
return mid+1;
if (a[mid] == mid+2)
search in subarray from start to mid-1
else
search in subarray from mid+1 to end
The only way is to redesign the application, keeping in mind the concurrency as a requirement.
- sachinvirgo February 24, 2008The array is the best data structure for this case. we only need to search the array by its index to check for ladder and snake. Once the array gets intialised we need not to insert or delete anthing, only search needs to be performed. This is what array is all about.
- sachinvirgo February 24, 2008here is the sample code(:-
public static void main(String args[])
{
String s= "C:\Dir1\Dir2\..\Dir3\.\Dir4\Dir5";
int i = s.indexOf("..",s);
while(i!=-1)
{
if(i==s.length()-2) \\incase .. is at end of string
s = s.substring(0,s.lastindexOf("\",i-2));
else
s = s.substring(0,s.lastindexOf("\",i-2)) + s.substring(i+2);
i = s.indexOf("..",s);
}
i = s.indexOf(".",s);
while(i!=-1)
{
if(i==s.length()-1) \\incase . is at end of string
s = s.substring(i-1);
else
s = s.substring(i-1) + s.substring(i+1);
i = s.indexOf(".",s);
}
System.out.println(s);
}
We can also use java strings with function lastindexOf() to attain the same.
-Sachin
RepAbigailFlores, AT&T Customer service email at A9
I have outstanding creative thinking skills that are helpful for overcoming issues in writing and for coming up with new ...
RepArnavPatel, abc at A9
Dedicated and energetic bakery assistant with a passion for flavor and a love for creating. Professional and dependable with more ...
RepLeenFawn, Analyst at A9
I have experience in managing all facets of front office administration, including handling multi-line phone systems, managing schedules, and maintaining ...
Repangeljperez232, Animator at ADP
Hello,I am a Marketing Manager. And I have 2+ experience in Marketing Manager.I like to read about vashikaran ...
RepRutviLopez, abc at A9
I have demonstrated skills in written communication with multiple award winning pieces and a strong willingness to revise and edit ...
RepKeithyMayes, Area Sales Manager at ASAPInfosystemsPvtLtd
Keithy , an administrative manager , Designs and access to technology to facilitate new infrastructure for students. and I have a hobby ...
Repnovathomes, abc at 8x8
I am a friendly and outgoing person who enjoys greeting people with a smile. I have more than eight years ...
RepAdaShipman, abc at 247quickbookshelp
During operation, determine all necessary adjustments to the printing press to maintain safety, quality and productivity standards and make such ...
Repyalendatopi, Dev Lead at Alliance Global Servies
I am Yalenda , a video editor with 3+ years of experience, skilled in Premiere Pro. Seeking position with Weingarten's ...
RepSteveParrish, Associate at ABC TECH SUPPORT
I am Steve , a Food Service Worker with a demonstrated experience in preparing various meals, maintaining kitchen equipment, cleaning the ...
Reprommie93544, Field Sales at Citrix Online
Roomie , an experienced group fitness instructor with the drive and knowledge and enthusiasm to apply the correct fitness techniques to ...
RepJaniferJack, Blockchain Developer at Bankbazaar
I am a writer who uses written words in different writing styles and techniques to communicate ideas. I produce different ...
RepMacHeist, Data Scientist at British Telecom
Mac, a Desktop Publishing Specialist at VitaGrey, where I provide document formatting and publishing support to a wide variety of ...
RepIsabellaRoy, Android Engineer at 8x8
I have excellent reporting and interviewing skills and award-writing techniques. I compose a variety of stories for print news and ...
Repanayadonal67, Animator at ABC TECH SUPPORT
AnayaDonal and I am a City planners. I have completed all my studies from Chicago. It's been a long ...
RepBruceKeter, HTML Experienced at 247quickbookshelp
Bruce , a pediatrician studies psychoanalysis where I try to understand children's needs and family dynamics. To do more research ...
Repreiviasmith, Malwarebytes customer service at ABC TECH SUPPORT
I am Reivia an outgoing and motivated Travel Consultant with over 5 years of experience in delivering professional travel related ...
Repgarlandkrebs, Animator at ADP
Highly focused and seasoned magazine editor with vast experience in all stages of weekly and monthly magazine production. My aim ...
RepAshleyDerri, Associate at Achieve Internet
I am Ashley, a highly qualified dynamic educator with experience educating and supporting students throughout the transition from high school ...
RepSamiyahKate, Java Experienced at Agilent Technologies
I am Samiyah, having 3 years of experience in assessing, diagnosing, screening, and preventing language, speech, and swallowing disorders. I ...
Reprajanadeep17, Android Engineer at 247quickbookshelp
I am a Special education teacher who adapts general education lessons and teaches various subjects to students with mild to ...
RepKianaEmmert, SDE1 at Home Depot
I am Kiana , an Entertainment Journalist, having 5 years of experience, in my career I have covered a lot of ...
Repjeansboylan698, Associate at 247quickbookshelp
JeanBoylan, and I am a Financial examiner and I love my work. Apart from this, Nowadays I am doing new ...
RepAidenKim, business planner manager at GPU
Expert business strategist with a sound understanding of organizational development and sales. Persuasive negotiator who uses integrity and professionalism in ...
Repsuzikaily, Digital marketing freshers at ADP
Hi , I am Suzi , working as a dancer in the Rudo club . I have been working here since 2013 and ...
Repsraceymiller, Android Engineer at ASAPInfosystemsPvtLtd
As a wellness pioneer, Life Time is reshaping the way consumers approach their health by integrating where we move, work ...
Rephugaliuli, Nurse at 8x8
Registered nurse with experience in delivering quality care to patients. Professional with more than 3 years in emergency room care ...
Reprafaeltanner210, Associate at 247quickbookshelp
I am Labor relations directors, oversee employment policies in union and nonunion settings. I draw up, negotiate, and administer labor ...
Repandrealmoore45, Analyst at 247quickbookshelp
My name is Andrea and I Live in california. I like to read articles from some interesting topics.And today ...
Repaishadavind7, Analyst at ASU
Being a Route driver I need to go here and there for the reason for delivering things here. I met ...
RepHelenHinkley, Accountant at 8x8
Dedicated English-Mandarin Chinese translator with years of experience working in professional and scientific communities. I am passionate about how to ...
Repkany7635, optician at AMMB
I am a detail oriented and knowledgeable optical assistant with 2 years of experience in an optometry office setting. Collect ...
RepMiaDavis, abc at 8x8
I have excellent communication skills that allow me to effectively lead my team and convey my ideas to them so ...
Repearleneefranks, Accountant at 247quickbookshelp
I am working as an Information clerk and I love my job. I also love to read new Articles related ...
RepZoeyUhl, abc at 247quickbookshelp
With a highly experienced law clerk, well respected and writing proficient, detail oriented and proficient in preparing legal memos of ...
RepLucyKaren, Android Engineer at Abs india pvt. ltd.
I am Lucy , a Web Administrator at Oshman's Throughout my professional life, I have proved my qualities multiple times ...
Rephizahula, abc at 8x8
I am Erica and have lived in the US for the last 4 years.I did my degree in the ...
Repaaronyocoma, U.S. marshal at Pacific Stereo
Working as U.S. marshal at Pacific Stereo numerous years . I encountered heaps of things . With this I likewise like ...
Repguthg713, Area Sales Manager at Broadsoft
I am News camera operator photojournalist who records video of news interest for television and online media outlets. I have ...
RepEllaJoni, abc at 8x8
By profession I am an auditing assistant with extensive experience in handling administrative duties and executive responsibilities associated with both ...
RepAbbyCox, abc at 8x8
I am an experienced, officially certified driving instructor. Excellent driver with a great safety record. Encyclopedic knowledge of traffic rules ...
RepLucasMoore, AT&T Customer service email at 8x8
I am creative with many years experience in the Advertising-Account Director, I have strong attention to detail and ability in ...
RepCamilaHill, Accountant at ADP
I am a performance-driven leader providing high-level administrative and operational support, coordinating schedules, preparing travel and documents, and exploring Surah ...
Repjacquelinejlopes48, Analyst at 247quickbookshelp
Hey, I am Jacqueline and I am a court reporter.I had heard a lot about Vashikaran Specialist,now I ...
RepSaanviJones, abc at 8x8
I am working as an office worker in a softage company. I am responsible for an office assistant position in ...
RepEileenWenda, DIGITAL MARKETING at Accenture
I am Eileen , a football Referee skilled at maintaining a safe environment for both players and observers, inspecting the playing ...
RepKeilyPrice, Applications Developer at 247quickbookshelp
I am a creative chef with 5 years of experience making the kitchen run efficiently. Collaborated with marketing specialists to ...
RepSimonPister, Blockchain Developer at Absolute Softech Ltd
Simon , a food scientist , records the Tracking status of all existing ingredients during the review and updating process and communicates ...
RepAakeshCruz, Accountant at Tinder
Exceptional knowledge of mathematical concepts, accounting and finance topics, tax code, and banking principles.Worked with clients and CFOs to ...
Repvickidsmithv, Android Engineer at 247quickbookshelp
Hello, I am a Managing editor. I have completed my studies from New York. Apart from this, whenever I am ...
RepEllaAllen, Accountant at 247quickbookshelp
I am a senior graphic designer with many years of experience managing quarter-million dollar design budgets. I specialize in strategic ...
RepAngelaFox, Android Engineer at AMD
My name is AngelaFox . I'm working at Integra Design as a Municipal court judge . The adjudicator acts in the ...
An idea: compare the last element of a list1(say a) with first element of other list2(say b). If a<b, just append the list2 to list1.
- sachinvirgo February 26, 2008We can further optimise it by comparing fisrt with first as well to proceed with correct order of merging