Problem 1
Complexity: Low
You are given two strings.
First string is a large text. For example
“It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).”
Second string is a short one. For example “is”.
You will need to write a program that will remove all occurrences of the second string from the first string.
Note: You will need to do this with pure for/while loops. Do not use any external functions like substring.
Complexity: Low
You are given two strings.
First string is a large text. For example
“It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).”
Second string is a short one. For example “is”.
You will need to write a program that will remove all occurrences of the second string from the first string.
Note: You will need to do this with pure for/while loops. Do not use any external functions like substring.
lot of candidates prepare well for the DSA round through Competitive Programming and get rejected.
It might be because they think the interview is just about writing the most efficient code fast.
But the interview is more about how one approaches and solves the problem.
You are expected to understand the problem, think clearly about it and ask questions to make it more structured and well-defined.
Once you have understood the problem and requirements, you can start to come up with a solution.
You need to make sure that you've considered the different scenarios along with the edge cases and that your solution is working perfectly.
Once the interviewer is satisfied with the solution, you start coding when they ask you to.
But, please keep these points in mind when you’ll start coding –
- Be very sure about the solution before you begin to code.
- Do not change the solution after you start to code
- Before you start coding, try to think about the overall structure.
- Try to keep the code modular.
- Dry run your code before telling the interviewer you’re done with the code.
- Try to find the failing test cases yourself instead of the interviewer doing it for you.
Preparing for interviews can be overwhelming but with Career Camp Freshers by Coding Ninjas, the process has never been easier!
1:1 Mock Interviews with industry experts and a dedicated placement team, all at your disposal.
Upskill yourself and land your dream job now. Go register yourself by clicking on the link in the first comment below.
Your dream job isn’t far away.
It might be because they think the interview is just about writing the most efficient code fast.
But the interview is more about how one approaches and solves the problem.
You are expected to understand the problem, think clearly about it and ask questions to make it more structured and well-defined.
Once you have understood the problem and requirements, you can start to come up with a solution.
You need to make sure that you've considered the different scenarios along with the edge cases and that your solution is working perfectly.
Once the interviewer is satisfied with the solution, you start coding when they ask you to.
But, please keep these points in mind when you’ll start coding –
- Be very sure about the solution before you begin to code.
- Do not change the solution after you start to code
- Before you start coding, try to think about the overall structure.
- Try to keep the code modular.
- Dry run your code before telling the interviewer you’re done with the code.
- Try to find the failing test cases yourself instead of the interviewer doing it for you.
Preparing for interviews can be overwhelming but with Career Camp Freshers by Coding Ninjas, the process has never been easier!
1:1 Mock Interviews with industry experts and a dedicated placement team, all at your disposal.
Upskill yourself and land your dream job now. Go register yourself by clicking on the link in the first comment below.
Your dream job isn’t far away.
Bug with the delete keyword :-
It deletes the elements value but never deletes the memory occupied that's why length is the same
It deletes the elements value but never deletes the memory occupied that's why length is the same