SDguy
BAN USER
- -2of 4 votes
Answersfind a pattern in byte array and change that pattern in place (do not use temp array or variable)
for example, find pattern 0,0,3 in an byte array and replace it with 0,0
should be o(n)
my solutions :
- SDguy in United StatesByte*remPattern003(byte arr[] , int &size) //size is input and output variable ///outputs size of output array { int k = 0; for(int i=0;i<size;) { if(arr[i] == 0 && arr[i+1] == 0 && arr[i+2] == 3) { arr[k++]=arr[i]; arr[k++]=arr[i+1]; arr[k]=arr[i+3]; i+=3; } else arr[k++]=arr[i++]; } size= k; return arr; }
| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Arrays
// returns index of the first matching char if sub string is found otherwise returns -1
int mystrstr(char *source , char*substr)
{
int i = 0, j = 0;
while (source[i] && substr[j])
{
if(source[i]==substr[j])
{
i++;
j++;
if(!substr[j])
return (i-j);
}
else
{
i=i-j+1;
j=0;
}
}
return -1;
}
Repellabryan25416, Accountant at A9
Hello, I am a Managing editor. I have completed my studies from New York. Apart from this, whenever I am ...
RepConnieLavender, Animator at Altera
My name is ConnieLavender . I am working as a Broker associate . I love field work and visiting different places to ...
Repednaheeks, Android test engineer at Automated Traders Desk
I am Edna, a blogger . As an editor with a strong background in English and Hindi language. I enjoy writing ...
Repcheyennejmartin8547, Android Engineer at 247quickbookshelp
Hey CheyenneMartin and I am working as a machine operator. Today I am doing a new research like vasiyam specialist ...
Repkristenjjimenezk, Analyst at ADP
We Statistical assistants establish and check numerical facts in many different areas of business, government, and industry. Right now I ...
RepHayleyGuez, Malwarebytes customer service at CDK Global
I am Hayley , a freelance artist with 7 years of experience in creating impressionist works. My most recent work was ...
RepJeanSwest, Data Engineer at Achieve Internet
I am a nuclear power reactor operator who is responsible for the flow of energy at a power plant. I ...
RepJamesDeal, Animator at Absolute Softech Ltd
My name is JamesDeal. I am working at Integra Investment Service as a Library aide . It's been almost 5 ...
RepMistySangra, Developer Program Engineer at Alliance Global Servies
I am Misty , working as a Database Administrator with 4+ years of experience installing, maintaining, and upgrading various servers and ...
RepDavidJohaan, Digital marketing Experinced at Abs india pvt. ltd.
I am David , a scanner operator for seven years in the industry Paearb. Six months ago , I’d an injury ...
Repdalecronin028, Animator at Pinterest
Hello, I am Dale. I am a Tourist guide who welcomes tourists . Tourist Guides act as ambassadors of the country ...
RepAlizaMaurice, Applications Developer at Absolute Softech Ltd
Aliza, a photojournalist with six years of experience capturing powerful images that tell stories. Have connections with a Vashikaran Specialist ...
RepYuvaanSmith, Analyst at ADP
Monitor and coordinate project information as it relates to the finances of the organization both before, during, and after bringing ...
RepI am a management dietitian who plans food programs . I use personal counselling , cooking demonstrations, lectures and workshops as a ...
RepTheresaHudson, IC3 at Broadsoft
I am Theresa , a Packer with a strong determination to finish all assignments in a timely manner. Inspected and ensured ...
Repolliejshea, Android test engineer at ABC TECH SUPPORT
Hello I am an application engineer. I love my work very much. Nowadays I am doing some new experiments. Like ...
RepLoriEver, Applications Developer at ASAPInfosystemsPvtLtd
LoriEver a Rancher working at William Wanamaker & Sons. It's been almost 6-10 years that he has been working this ...
RepCecilRenteria, Managing editor at Alliance Global Servies
A Managing Editor, or Content Manager, I" m creates content strategies and oversees their implementation processes. spent 2/3 years ...
RepJohnHentz, Animator at Abs india pvt. ltd.
JohnHentz is a Responsible Financial planner working at Plan Smart Partner . i Analyze clients' financial statuses income, expenses and liabilities ...
Replindagwingard, Android test engineer at ABC TECH SUPPORT
Hello, my name is Larry and I am a commercial loan officer. We are commercial loan officers who specialize in ...
RepNirvedPerez, abc at 8x8
To make sure a thorough investigation is done if discrepancies occur. Execute the Brand Customer Service standards to meet or ...
Replauriedfrankel8754, Analyst at 247quickbookshelp
Hey, I am a Data typist. I love this work. My hobby like write story and different types of article ...
RepMarlinThomas, Backend Developer at ASAPInfosystemsPvtLtd
I am Marlin, an industrial maintenance mechanic. I can help you create a job listing. Feel free to revise, add ...
Repkentyoung319, Applications Developer at ABC TECH SUPPORT
I am KentYoung . I am working as an Orthotics technician at The Wiz . As an orthotic technician,I manufacture orthotic ...
RepManilaRoche, Animator at Abs india pvt. ltd.
Manila , an extensive executive assistant with experience of 4 years in the field of administrative functions, managing the office of ...
Repmeerjahelesan, Backend Developer at Abs india pvt. ltd.
My name is FredHolli. I am working at Warner Brothers Studio Store as a Human resources clerk .I mostly spend ...
RepAlicaKnight, Blockchain Developer at ABC TECH SUPPORT
Alica , an Employment Consultant with extraordinary achievements in providing beneficial career consultation, organizing various workshops and webinars, and helping clients ...
Repmaryctedesco7485, Accountant at ABC TECH SUPPORT
Efficient Production Manager with 15 years of experience leading diverse manufacturing teams to create high-quality products at top speeds. Dedicated ...
Repjohnsantana9ytt9, Backend Developer at Accolite software
I am working as a Support service manager at Pro Star Garden Management . I had a different experience while working ...
RepHenryBrown, Associate at A9
I am an experienced budget analyst skilled at researching and consolidating financial and budget information. I am taught record keeping ...
RepJessicaMoss, Member Technical Staff at Bloomberg LP
Jessica , a technical writer with 5+ years of experience writing high-quality internal and user-facing support. As I love to write ...
RepJanaSmith, Integration Software Engineer at Deloitte Consulting LLP
I am Jana , an order processor with my strong work ethic. My interests are listening to music which helps me ...
RepBessieHicks, Area Sales Manager at Accolite software
Professional Aerobics instructor with over 2 years experience in this field . I am working at Wilson's Jewelers . I am ...
RepjasOlan, Field Sales at Credit Suisse
hi, I am Isom. I am a Security and fire alarm systems installer. I therefore play an important role in ...
Rephuslafenena, Backend Developer at Absolute Softech Ltd
I am working as a Teletype operator at Midwest TV & Appliance . It's been almost ten years since I've ...
RepJaninaGilden, Java Experienced at Boeing
I am Janina , a Registered Nurse with 3 years experience providing healthcare to a variety of patients in different institutions ...
RepLaylaMoore, Analyst at ADP
I am a skilled content editor with 3 years of excellent service in the communications field. I developed, researched, and ...
Repruchimosha, Analyst at Absolute Softech Ltd
My name is MaryDuncan . I am working at Crandall's Fine Furniture as a Probation officer . Here I am dealing ...
Repmarksloan761, Backend Developer at Apache Design
As a Meeting manager at Red Bears Tavern here I am working for approximately ten years . In my daily life ...
RepAtharvFlores, Accountant at A9
I am working as a position of a court clerk to assist the judges as attorneys in expediting the court ...
RepEllaScotz, abc at A9
I am a creative designer with innovative ideas and a unique approach to visuals. I am also a skilled painter ...
RepRosieBell, Accountant at 8x8
I have technical knowledge of multiple camera technologies -Extensive communication, cooperation, and service skills -Critical thinking, analysis, free revenge spells ...
RepNaomiSmith, Integration Software Engineer at ASU
Naomi , a strategic Merchandise Buyer with over 4 years of professional experience in merchandise planning and purchasing positions. Advanced presentation ...
RepGladysPhillips, Associate at ADP
I have dedicated my professional career to fostering vibrant and harmonious communities.I have successfully navigated the complexities of community ...
RepEsotaTaylor, abc at 8x8
I am working as a lecturer with exceptional teaching abilities seeking employment in your organization. I have excellent experience in ...
RepJenniaLopez, Associate at Absolute Softech Ltd
Jennia , a hard-working Packer with a strong determination to finish all assignments in a timely manner. Replaces , operates and maintains ...
Repbenaryhell3454, Blockchain Developer at A9
Working as a carpet installer at Simple Solutions is almost 10 years . Here I daily meet new people and learn ...
Repedenwraye, Photographic spotter at Enrich Garden Services
I'm more of a Photographic spotter than an expert at creating beautiful, functional and personalised products for teachers, mentors ...
RepSammyTurner, HR Executive freshers at Abs india pvt. ltd.
Sammy , an experienced mortuary service provider performed a variety of tasks involved in holding appropriate and solemn rites during funeral ...
RepMyraGreen, Accountant at 8x8
I am a dedicated secretary with 2 years of experience excited to join MCL to become a key player in ...
Reppetersmith36788, Animator at ABC TECH SUPPORT
I am working at Eden Lawn Service as a Bridge and lock tender . Here I manage all the things like ...
RepSaanviJones, abc at 8x8
I am working as an office worker in a softage company. I am responsible for an office assistant position in ...
Reppedrospencerp, Blockchain Developer at 247quickbookshelp
My name is Pedro and I am a 28 years old Title abstractor . I research all documents and activities affecting ...
Repsuegdiaz765, Android test engineer at 247quickbookshelp
My name is Sue and I am a Specialist. We Specialist employees are responsible for specific tasks or activities in ...
Reppamelajones9873, Area Sales Manager at Facebook
Hello I am Pamela Jones. I am an Animal Control Worker Here, Animal control officers are generally employed by a ...
RepDarikaLee, Applications Developer at ADP
I am a knowledgeable and performance-driven Network Administrator with a comprehensive background in managing servers, maintaining software/hardware, performing backups ...
Repcolleenpbeverly02, Android test engineer at ABC TECH SUPPORT
Hello I am Colleen Dedicated and hardworking Geographic information specialist analyst with 15 years of experience working with ArcGIS software ...
Repggroverwmiller, Android Engineer at 247quickbookshelp
Hello I am a Budget officer with 5 years of experience. The Budget Officer implements budgeting and financial record keeping ...
Repericsumm059, Backend Developer at ASU
My name is EricSummey . I am working as a Sound engineering technician at Foreman & Clark . as a sound technician it ...
Replinhhonibh, Animator at ABC TECH SUPPORT
I am an experienced, officially certified driving instructor. Excellent driver with a great safety record. Encyclopedic knowledge of traffic rules ...
RepAmyuDiaz, abc at 8x8
Professional cost accountant with several years of experience in accounting tasks such as maintaining inventory, calculating liability, budgeting labor costs ...
Repchomeshgeles, Android Engineer at ABC TECH SUPPORT
ReevesMildr , a builder working at Independent Investors . It has been almost 5 years since I have been working here. I ...
Repulrikefiedler789, Animator at 247quickbookshelp
Hello I am a journalist with 5 years of experience crafting timely, informative and factual stories with attention to complexity ...
RepMargySpencer, Area Sales Manager at ABC TECH SUPPORT
Hey my name is Margy and i am a scientific photographer. I have full experience of 5 years of work ...
RepBhrisBrown, Animator at Achieve Internet
I teach the art of cooking, including food preparation, various cuisines, and techniques of cooking. I work at colleges and ...
RepBravoDwayne, Blockchain Developer at ADP
Bravo , a Broker Assistant skilled at assisting financial advisors and stockbrokers in any tasks as required. As I love to ...
RepIvyBare, abc at A9
I am a driven professional with over 5 years of increasing responsibility in staff development, instructional design, and program administration ...
// some C/C++ style pseudo code
- SDguy May 14, 2013// needs some validations such as check for invalid pointers and etc..
{{
node* reverse_linked_list( node * head)
{
if (head== NULL || head->next==NULL)
{
return head;
}
node *new_head = reverse_linked_list(head->next);
head->next->next = head;
head->next = NULL;
return new_head;
}
Node * MiddleOfList(Node *head)
{
node * middle ;
node * temp = head;
while(temp ->next!=NULL)
{
temp =temp ->next->next
middle = middle->next
}
return middle;
}
BOOL palindrome (Node *head)
{
Node *middle = MiddleOfList(head) ;
head = reverse_linked_list(middle)
while (middle ->next != NULL)
{
if (middle->data == head->data )
continue;
else return false ;
}
return true
}
}}