LeetCode #9: Palindrome Number

preview_player
Показать описание
A step-by-step visualization of #Leetcode question 9: Palindrome Number.

0:00 Problem Description
0:28 Strategy Overview
1:35 Code Walkthrough
4:30 2nd Example

#coding #programming #algorithms #tech #faang #softwareengineer
Рекомендации по теме
Комментарии
Автор

Add more videos !!! Great explaination

SimranMallar
Автор

great explanation i knew what way to think but didnt know how to implement it

nihalbhamrah
Автор

eee good, спасибо большое = thank you very

LDanya
Автор

JESUS, dude this video was amazing
I have adhd so its hard to focus on videos or books but I saw your solution on leetcode and saw you attached the video.
I swear that about 6 minutes ago I didn't even know where to begin and now I feel like I could explain this someone else.
Believe me, that is an achievement lol Definitely subbing and I wish you a lot of success. You are definitely special and are going to help a lot of people.

FRAMEDSKATEKREW
Автор

As a beginner and not an English speaker this explanation is easy for me to understand👍

librahuang
Автор

your explanation is so good, keep it up🤙

husseinhadliye
Автор

It wasn't easy you made it sound easy!1! brilliant!!!

codecompass
Автор

math coding if mod or floor/ceiling function never existed

KookyPiranha
Автор

The explanation was good, even though I approached it using Java.

jacksonlow
Автор

how to do it into the first way? :)
i cant find info, what is "x = str(x), x == x[::-1]"

alexito-pvrlx
Автор

what is the time and space complexity of second solution?

bhaktipatekar
Автор

IDK why but when taking input as 121 it shows false even though it is true?

Unkonw
Автор

why you need to convert x into a string??

Richard-yzgy
Автор

#include<bits/stdc++.h>
class Solution {
public:

bool isPalindrome(int x)

{
vector <int> hash;
if (x<0)
return false;
else
{
if (x>0 && x <=9) // single digits are palindrome
return true;
else
{
while (x>9)
{
int y = x%10;
x = (x-y)/10;
hash.push_back(y); // increment count
}
hash.push_back(x);
bool decision = true;
auto itr1 = hash.begin();
auto itr2 = hash.rbegin();
for ( int i=0; i<hash.size()/2; ++i, ++itr1, ++itr2)
{
if (*itr1!= *itr2)
decision = false;
}
return decision;


}

}

}
};
I maintained two pointers, one from start and one from end after splitting separate digits. I know it's not near to optimal. I just started CP. How do you come up with such elegant solutions at first sight?

alijohnnaqvi