2

If you are in an interview using Python, assume that the interviewer is reasonable and wants you to write fluent Python code. That means, among other things, taking advantage of the language's built-in powers: def defrang(ip): return ip.replace('.', '[.]') But let's suppose that the interviewer explicitly directs you to ignore built-ins and write your ...


2

Your code does what you describe, but the code does not what it is really supposed to do. You are not the first person ever who needs to convert an arbitrary string into a form that can be embedded in a URL. Several people before you have already solved this problem. The crucial point is to know how these people named the method or function or class or ...


1

Review Welcome to Code Review. There are some suggestions as follows. Consider to use replaceAll The operation you performed is what String.replaceAll do, you can use replaceAll directly instead of String.toCharArray(), whitespace comparison, and sb.append things. Create a method URLify In order to improve usability, it is better to create a method URLify to ...


Only top voted, non community-wiki answers of a minimum length are eligible