Implement Atoi | GeeksForGeeks | Problem of the Day | Python | C++

  Рет қаралды 79

Mathematics

Mathematics

Күн бұрын

Пікірлер: 3
@mathematics3398
@mathematics3398 14 күн бұрын
Table of Contents 0:00 Problem Statement 0:35 Solution 4:50 Pseudo Code 7:30 Code - Python 8:26 Code - C++
@mathematics3398
@mathematics3398 14 күн бұрын
class Solution: def myAtoi(self, s): i = 0 INT_MAX = 2147483647 INT_MIN = -2147483648 ans = 0 is_negative = False while i < len(s) and s[i] == ' ': i += 1 if s[i] == '-': is_negative = True i += 1 while i < len(s) and (s[i] >= '0' and s[i] INT_MAX/10 or (ans == INT_MAX/10 and digit > 7): return INT_MIN if is_negative else INT_MAX ans = ans*10 + digit i += 1 if is_negative: return -ans return ans
@mathematics3398
@mathematics3398 14 күн бұрын
class Solution { public: int myAtoi(char *s) { int ans = 0; bool is_negative = false; int i = 0; while (s[i] != '\0' and s[i] == ' ') i++; if (s[i] == '-') { is_negative = true; i++; } while (s[i] != '\0' and (s[i] >= '0' and s[i] INT_MAX/10 or (ans == INT_MAX/10 and digit > 7)) return is_negative?INT_MIN:INT_MAX; ans = ans*10 + digit; //cout
Codeforces Round 991 (Div 3) | Video Solutions - A to G | by Viraj Chandra | TLE Eliminators
2:37:41
What Is Dynamic Programming and How To Use It
14:28
CS Dojo
Рет қаралды 1,6 МЛН
А я думаю что за звук такой знакомый? 😂😂😂
00:15
Денис Кукояка
Рет қаралды 6 МЛН
She made herself an ear of corn from his marmalade candies🌽🌽🌽
00:38
Valja & Maxim Family
Рет қаралды 15 МЛН
УДИВИЛ ВСЕХ СВОИМ УХОДОМ!😳 #shorts
00:49
5 Simple Steps for Solving Any Recursive Problem
21:03
Reducible
Рет қаралды 1,3 МЛН
31 nooby C++ habits you need to ditch
16:18
mCoding
Рет қаралды 835 М.
My 10 “Clean” Code Principles (Start These Now)
15:12
Conner Ardman
Рет қаралды 299 М.
Making an Algorithm Faster
30:08
NeetCodeIO
Рет қаралды 166 М.