CDOEINTER Flashcards

1
Q

write a program that breaks up a string of words with no spaces into a string with the appropriate spaces.

A

1, clarify the problem, ask questions
what about the the null string?
what about the other corner cases?
what if I have a number or other characters?

state the key assumptions.

make sure then the signature, what’s coming in and what’s coming out.

2, start with the first solution that comes to mind (brute force)
don’t assume the code works. assume you are reading the code written by someone else, so check for edge cases, and the < > =. make sure your resursion works.
try to write the reasonable variable names. ask the interviewers if there is something forgotten.

3, Refine the solution

4, Examples

5, Optimize

How well did you know this?
1
Not at all
2
3
4
5
Perfectly