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.
Code solution to sample question #2
From the course: Get Ready for Your Coding Interview
Code solution to sample question #2
- [Instructor] Let's see what my solution might look like in code two sample interview question number two with string. If you'd like to follow along, open your exercise file for this problem with jupyter notebook. The problem was comparing two strings as numbers, and remember that larger than "11" should return False because we are doing a strict comparison here. And also remember that you can compare single digit numbers in strings like this, three larger than one should return True because the number three is larger than the number one. (scrolling through screen) And let's implement our function right here. And this function, first of all, will compare the lengths of a and b. And if the length of a is larger than the length of b, (pressing keyboard) for example, if a is equal to 222 in a string and b is equal to 99 in a string, then we should return True here because the number a is larger than the number b. And…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.