From the course: Get Ready for Your Coding Interview

Unlock the full course today

Join today to access over 23,100 courses taught by industry experts.

Sample interview question #2: String

Sample interview question #2: String

From the course: Get Ready for Your Coding Interview

Sample interview question #2: String

- [Instructor] Here is "Sample Interview Question #2 with String." Here's the problem. You're given two strings, which represent two integers. For example, these two on the screen, 1,232 and 201. And the problem is writing a function that compares these two strings as numbers. Let's say we want to write a function that's called larger then which takes these two strings as inputs and returns true if the first number is larger than the second one. If the first number is less than the second one, for example, 202 is less than 232, then we should return false from this function. If this question is asked in your actual interview, you might want to ask these clarifying questions. Could the strings be empty? No, just assume that they are never empty for convenience sake. Could the numbers be negative? No, they're always non-negative. So they're always either zero or positive. Can I use the int function to convert the…

Contents