by jeffbee · 3y ago · 0 comments
Note that the "solution" that ChatGPT proposes as O(1) is not in fact O(1) because it copies the input to the output which is necessarily O(N) regardless of how much dodgy logic is inside the function.
9999999.... requires n steps to modify it to 10000.....
Of course, you need to start at the correct end, otherwise it's logarithmic just to get there.