Check for Palindrome | Data Structures & Algorithms

  Рет қаралды 10,087

JomaClass

JomaClass

Күн бұрын

Пікірлер: 27
@muhammadhashir7949
@muhammadhashir7949 4 жыл бұрын
Sir I love your videos I'm from Pakistan.exited for your next video on your main channel
@YiTseng
@YiTseng 4 жыл бұрын
6:45 Joma: imagine if I had another odd number.... Me: (think K...) Joma: for example like K.... Me: what!?
@debasishphukon5345
@debasishphukon5345 4 жыл бұрын
Please keep posting this is some amazing content right here
@RecursiveLoops
@RecursiveLoops 4 жыл бұрын
Technically the correct time complexity is Θ(n). Reading the input string requires Θ(n) and reading the dictionary requires O(n). Θ(n) + O(n) = Θ(n) I'm not opinionated, but if you state that this algorithm runs in O(n) it means that the worst case is linear; this implies the existence of some cases where the algorithm runs better, but it is not true because the reading of the input string defines the algorithm's lower bound in terms of time complexity. In any case great video and I wish you the best of luck with your new project :)
@doboy
@doboy 4 жыл бұрын
It's both, everything that is Θ(n) is also O(n) but not vice versa.
@RecursiveLoops
@RecursiveLoops 4 жыл бұрын
Zack Do yes, but one of them is simply more precise :) In this case it's easy to calculate Big Theta and gives more information about the time complexity. I know that Big O is more mainstream than Big Theta...
@aadityabhetuwal5990
@aadityabhetuwal5990 4 жыл бұрын
it' not gonna be O(n) if you use set() because it removes all duplicates and iteration can be performed in n/2 + 1 passes for the worst case.
@samuelemerlin
@samuelemerlin 4 жыл бұрын
This was the first problem I solved with Python 💪
@wettaco6938
@wettaco6938 4 жыл бұрын
Question : why can't we just reverse the string and test if the reversed version = string ?
@devinh.9683
@devinh.9683 4 жыл бұрын
because they will give you strings that could be palindrome, but not currently a palindrome. This solution will work only if the string they give you is currently a palindrome.
@aadityabhetuwal5990
@aadityabhetuwal5990 4 жыл бұрын
easy python solution using itertools: import itertools as it def find_palindrome(st): st = st.lower() x = list(it.permutations(st, len(st))) for i in x: s1 = "".join(i) flag = False if s1 == s1[::-1] : return s1 return False print(find_palindrome( input() ))
@aryaman_godara
@aryaman_godara 4 жыл бұрын
qqaao ... we can make pa;indrome , bro are you sick or am i hogh too much ???
@whistletoe
@whistletoe 4 жыл бұрын
Why can’t qqaao be made into a palindrome? Like qaoaq?
@JomaClass
@JomaClass 4 жыл бұрын
The example was qqaaao, not qqaao
@whistletoe
@whistletoe 4 жыл бұрын
Joma Class Oooh sorry my screen was too small lmao
@pedroalonsoms
@pedroalonsoms 3 жыл бұрын
great video thanks
@SunsetRacer
@SunsetRacer 4 жыл бұрын
Now joma being a ronin. There is no more naniiiii😒
@ws_zilch
@ws_zilch 4 жыл бұрын
Thanks jomaoppa :)
@bridgegolden238
@bridgegolden238 4 жыл бұрын
what happened to the old logo 😭
@hugelevin
@hugelevin 4 жыл бұрын
Can you provide a simplified Java code version of this exercise? I have managed to do it using HashMap but have a lot of code while yours seems so simple. Thanks.
@colinking73
@colinking73 4 жыл бұрын
Puh-linndrahm
@KuaisArts
@KuaisArts 4 жыл бұрын
great video but the way you say palindrome tho...
@hectorsvill
@hectorsvill 4 жыл бұрын
😄
@rudraprasaddash3809
@rudraprasaddash3809 4 жыл бұрын
How about this:- def isPalindrome(s): If (s==s[::-1]): return True return False 🤔🤔
@JomaClass
@JomaClass 4 жыл бұрын
The question asks if a string can be rearranged to BE a palindrome. It doesn’t just check if it’s a palindrome. So for example, “dda” should return true because it can be rearranged to “dad”
@rudraprasaddash3809
@rudraprasaddash3809 4 жыл бұрын
@@JomaClass o...oh, domo🙇. Nice solution
What is Recursion? A Python Example
13:28
JomaClass
Рет қаралды 13 М.
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 41 МЛН
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 700 М.
Leetcode problem Longest Palindromic Substring (two solutions)
25:19
Errichto Algorithms
Рет қаралды 164 М.
Special Programs in C − Check If The Number Is Palindrome Number
8:14
Longest Palindromic Substring - Python - Leetcode 5
8:11
NeetCode
Рет қаралды 584 М.
Longest Palindromic Substring Manacher's Algorithm
16:46
Tushar Roy - Coding Made Simple
Рет қаралды 349 М.
Poison Wine Problem: Understanding Bits
7:49
JomaClass
Рет қаралды 21 М.
What Is Big O Notation?
17:45
Reducible
Рет қаралды 319 М.
Programming Anime: Floyd's Algorithm Explained
19:44
JomaClass
Рет қаралды 269 М.
If Programming Was An Anime
3:26
Joma Tech
Рет қаралды 10 МЛН
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 41 МЛН