Google Engineer Explains - LeetCode #8 - String to Integer (atoi) - Solution (Python)

preview_player
Показать описание
Explanation of LeetCode #8 - String to Integer (atoi) with discussion of Time and Space Complexity and Integer Overflow.
(Medium Difficulty)

00:19 Overview of Approach
03:43 Implementation
11:30 Time and Space Complexity
12:46 Optimization to Address Integer Overflow
Рекомендации по теме
Комментарии
Автор

i am very confused about the language ..which one should is choose- python or java please helpp, ,
my main target is to crack google

TigerShroff-bbwc
Автор

The question said we either gonna see + or - symbols but in some test cases I have both + and - symbols

LinhLe-cpcl
Автор

Doesn't work for input's like "-+12"

NavinChaganti
Автор

@Google Engineer Explains I wonder how would the output be for input like "+-12", "+" and "-". In theory it should be zero, but in your code you miss to handle this issue.

littleowl
Автор

Thanks for this, very clear explanation

oooo-rcyf
Автор

This solution is wrong. We are using 32-bit variables and you can't apply something like min(res, MAX_INT), you are basically overflowing your integer. That is an important part of the question and you ignore it. Also, the question states that the number may have 200 digits, which corresponds to 665 bits and you save that value in a variable... Good way to fail the interview

berkuygun
Автор

thank you so much for explaining but my question is that you type invalid 5 different stuff how do you know this I mean before start codding first thing to think every other way for valid and invalid ? hope i explained myself well keep it up I subscribe your channel and hopefully one day will work for google as well

metehand
Автор

Hey, I am very confused about which language to choose for my Google Coding interview. I'm confident in both java and python. Please give me the best choice.

DP-qyfc
Автор

Yes its not working for some testcases with python3

pratikgehlot
Автор

what did they teach you at Berkley? strip() to remove all whitespace, isnumeric() or isdigit() to check for its type. These are built in methods.

ShoeAlmighty
visit shbcf.ru