- Change the way you’re doing the loop if you face a problem in reaching the first and/or the last character.
- If you want to compare each two adjacent characters then it’s better to start with a loop with counter = 0.
- It is not always about adding new items to the result objects, sometimes think about starting with a full object ad then to remove some items from it.
- Change your location or do something when you reach a point when you cannot find the error and you feel like it’s so silly.
- Organize your work by writing separated method for each task that you specify in your algorithm.
- Write the sample case on a paper or on a board and try to solve it and do all the statements and loops manually. Then translate what you did by writing steps. Then translate these steps into an application steps.
- Use long and double for the numbers when expecting big inputs.
- If you have to find at least one common letter in two string arrays, it’s better to do the loop on an array that contains all the English letters.
Categories
Advises for solving strings problems and algorithms
