Largest Odd Number in String | Amazon | Leetcode 1903

preview_player
Показать описание
This is the 5th Video of our Leetcode Easy Playlist.
In this video we will try to solve an easy string problem - Largest Odd Number in String (Leetcode 1903).

I will explain the intuition so easily that you will never forget and start seeing this as cakewalk EASYYY.
We will do live coding after explanation and see if we are able to pass all the test cases.
Also, please note that my Github solution link below contains both C++ as well as JAVA code.

Problem Name : Largest Odd Number in String
Company Tags : Amazon

Approach Summary :
The provided code iterates through the digits in reverse order and returns the largest odd number by removing digits from the end of the string in order to find Largest Odd Number in String. If no odd digits are found, it returns an empty string.

╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝

✨ Timelines✨
00:00 - Introduction

#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa
Рекомендации по теме
Комментарии
Автор

283 days of
Thanks for the explanation :)

oqant
Автор

was able to build the intuition in 5 mins . thnx 😇

alokgautam
Автор

i'm really addicted to your channell

aarzoo
Автор

num[i] & 1 is also work for odd
We don't require to convert char to int in this question 😊

RajGupta-cuhi
Автор

I think ye extra hard questions aane se pehele ki shaanti hai :)

sauravchandra
Автор

I was converting it to number then applying the operations, then I tried generating all the substring and printing the odd largest, but this was the best and easy solution.

Ashborn-gr
Автор

Great thanks bhaiya keep up the good work.

mma-dost
Автор

Bhaiya please make a video on leetcode 424. Longest Repeating Character Replacement
i have tried a lot of videos, but i am not able to understand the logic, please make the video asap. 😥

amitshukla
Автор

Bhaiya, is your system design playlist sufficient for cracking a job interview at a big MNC as a fresher? a fresher?

harikrushnasuhagiya
Автор

why start from right ? why we can not start with left?

harikrushnasuhagiya
Автор

class Solution {
public String largestOddNumber(String num){
for(int i=num.length()-1;i>=0;--i)
if((num.charAt(i)-'0')%2==1)
return num.substring(0, i+1);
return " ";
}
}
Tc=0(n);
Sc=0(n);
🎉❤

dayashankarlakhotia
Автор

October - Mostly hard
November - Mostly medium
December - Mostly easy
🥲🥲
Don't want to end this year solving easy questions

de_coder