Palindrome Number LeetCode Solution

Difficulty Level Medium
Frequently asked in Adobe Amazon Apple Bloomberg Cognizant Infosys Microsoft TCS Uber YahooViews 88

Problem Statement

Palindrome Number LeetCode Solution says that –

Given an integer x, return true if x is palindrome integer.

An integer is a palindrome when it reads the same backward as forward.

  • For example, 121 is a palindrome while 123 is not.


Example 1:


 x = 121




 121 reads as 121 from left to right and from right to left.

Example 2:


 x = -121




 From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.


  • -231 <= x <= 231 - 1



  • In order to find the Palindrome Number. First, we will focus on the palindrome if the given number is equal to the reverse of the given number then we can say that the number is a palindrome and return True else return False.


  • First, we will make one variable Total, and initially, the value of the variable will be zero then we will use the condition that the given number should be greater than zero then we will find the modulo of that number and add that number into the total by using total = total*10+number and at last, we will update the number by number // 10.
  • At last, we will return the Total.


Palindrome Number LeetCode SolutionPin


Palindrome Number Python LeetCode Solution:

class Solution:
    def isPalindrome(self, x: int) -> bool:
        total = 0
        k = x
        while(x > 0):
            b = x%10
            total = total*10+b
            x = x//10
        if total == k:
            return True
            return False

Palindrome Number Java LeetCode Solution:

class Solution {
    public boolean isPalindrome(int x) {
        int total = 0;
        int k = x;
        while(x > 0){
            int b = x%10;
            total = total*10 + b;
            x = x/10;
        if(total == k)
            return true;
        return false;

Complexity Analysis :

Time complexity:


Space complexity:


Similar Problem:

Top Interview Questions

S.No Interview Question Number of times has been asked
1Delete a node in doubly linked list2821
2Java program to find the number of Nodes in a Binary Tree2500
3Reverse a string without affecting special characters2463
4Delete a node of a linked list at given position1976
5Palindrome using Recursion1827
6Insert nodes in a linked list in a sorted way (Ascending Order)1662
7Find elements pair from array whose sum equal to number1650
8Sort Elements by Frequency of Occurrences1632
9Write a program to print all permutations of a given string1607
10Find Minimum Distance Between Two Numbers in an Array1476
11Create a Doubly Linked List1444
12Quick Sort1420
13Reverse an Array1414
14Smallest window in a string containing all characters of another string1395
15Find a Triplet That Sum to a Given Value1357
16Recursively remove all adjacent duplicates1354
17First Repeating Element1339
18Arrange Even and Odd number such that Odd comes after Even1323
19Sum of numbers in String1318
20Smallest Positive Number Missing in an Unsorted Array1284
21Check if the Elements of an Array are Consecutive1253
22Detect a loop in the Linked List1237
23Largest Sum Contiguous Subarray1230
24Subarray with Given Sum1214
25Quick Sort on SIngly Linked List1214
26Print all Possible Combinations of R Elements in a given Array of size N1206
27Recursive function to do substring search1197
28Find the Maximum Repeating Number in Array1156
29Binary Tree Level order traversal in Java1125
30Find the First and Second Smallest Elements1122
31Check if two linked lists are identical1104
32Maximum Subarray Sum using Divide and Conquer1099
33Remove characters from first string which are in second1070
34Find Leaders in an Array1062
35Swap nodes in the linked list1036
36Find the Number Occurring Odd Number of Times in an Array1002
37Arrange given Numbers to Form the Biggest Number II994
38Find the second most frequent character990
39Given a string find its first non-repeating character971
40Find Triplet in Array With a Given Sum965
41Given a sorted array and a number x, find the pair in array whose sum is closest to x956
42Total number of occurrences of a given item in the linked list952
43A Program to check if strings are rotations of each other or not944
44Print all possible words from phone digits935
45Find the Missing Number927
46Rearrange Positive and Negative Numbers Alternatively in Array921
47Longest Palindromic Substring906
48Segregate even and odd nodes in a linked list883
49Print Longest common subsequence882
50Union and Intersection of Two Linked Lists871
51Transform one string to another using minimum number of given operations869
52Rearrange given Array in Maximum Minimum Form846
53Check rearranged string can form a palindrome845
54Count Possible Triangles819
55Iterative Implementation of Quick Sort816
56Multiplication of Two Matrices802
57Check if the linked list is palindrome796
58Count of Triplets With Sum Less than Given Value792
59Rotate a Linked List791
60Stock Buy Sell to Maximize Profit789
61Concatenation of two strings762
62Tug of War760
63Count Number of Substrings with K Distinct Character’s758
64Print all duplicates in the input string754
65Find Nearest Greater and Smaller Element748
66The Celebrity Problem737
67Find Pythagorean Triplets from Array736
68Reverse String Without Temporary Variable735
69Remove ‘b’ and ‘ac’ from a given string728
70Find all Common Elements in Given Three Sorted Arrays728
71Remove all duplicates in an unsorted linked list710
72Find the Row with Maximum Number of 1’s706
73Find the Peak Element from an Array702
74Find the subarray whose sum is equal to a given number X697
75Remove Minimum Characters so that Two Strings Become Anagrams689
76Find Smallest Missing Number in a Sorted Array689
77Insertion Sort686
78Addition of Two Matrices686
79A Product Array Puzzle685
80Implement Two Stacks in an Array677
81Generate all Binary Strings Without Consecutive 1’s672
82Maximum Sum of Non Consecutive Elements668
83Maximum Product Subarray II659
84Lexicographic rank of string655
85Check if Two given Matrices are Identical645
86Multiplication of Previous and Next644
87Merge K Sorted Arrays and Print Sorted Output633
88Subtraction of Two Matrices633
89Move All the Zeros to the End of the Given Array630
90Online Algorithm for Checking Palindrome in a Stream625
91Form Minimum Number from Given Sequence of D’s and I’s624
92Divide a string in N equal parts622
93Maximum Circular Subarray Sum614
94Check whether two strings are anagram of each other614
95Sort a linked list that is sorted alternating ascending and descending609
96Remove recurring digits in a given number609
97Sort a stack using a temporary stack608
98Find the Minimum Element in a Sorted and Rotated Array605
99Subarray and Subsequence602
100Move last element of the Linked List at first place601
101First Circular Tour to Visit all the Petrol Bunks601
102Largest Subarray with Equal Number of 0’s and 1’s598
103Compare two strings(linked lists)592
104Flattening a linked list592
105Maximum Element in an Array which is Increasing and then Decreasing590
106Palindrome Permutations of a String585
107Elements Appear more than N/K times in Array582
108Majority Element576
109Run length encoding575
110Minimum insertions to form a shortest palindrome573
111Palindromes in a given range572
112Print all permutations with repetition572
113Pangram Checking570
114Merge a linked list into another at alternate positions568
115Minimum Characters to be Added at Front to Make String Palindrome566
116Remove all duplicates in a sorted linked list563
117Rearrange a given linked list in-place562
118Minimum number of Merge Operations to make an Array Palindrome561
119Most repeating character in a string558
120Rotate string to get lexicographically minimum string557
121Repeated Subsequence of Length Two or More557
122Print all anagrams together in a sequence of words552
123Reorder an Array According to the Given Indexes550
124Pancake Sorting Problem543
125Merge Overlapping Intervals II539
126Two Sum Leetcode Solution539
127Clone a Linked List with next and random pointer537
128Size of The Subarray With Maximum Sum528
129Transpose of a Matrix524
130Removing Spaces from a String using stringstream521
131Remove Extra Spaces from a String520
132Smallest Palindrome after Replacement520
133Remove duplicates from a string519
134Check if a given string is a rotation of a palindrome519
135Partition Problem517
136Maximum Sum Increasing Subsequence517
137Longest Palindrome can be Formed by Removing or Rearranging Characters513
138Check whether Strings are K Distance Apart or Not503
139Delete Last Occurrence502
140Generate all Binary Strings from Given Pattern502
141Find Zeros to be Flipped so that Number of Consecutive 1’s is Maximized501
1423Sum Leetcode Solution500
143Insert Node in the Sorted Linked List499
144Length of Longest valid Substring499
145Check if Two given Strings are Isomorphic to each other494
146Maximum difference between two elements such as larger element comes after smaller488
147Program to Toggle all Characters in a String483
148Given string is interleaving of two other strings or not482
149Count Minimum Steps to Get the given Array480
150Number of Smaller Elements on Right Side480
151Merge sort better than quick sort for linked lists478
152Find Pair with Given Difference473
153Check length of a String is Equal to the Number Appended at its Last471
154Check if all Rows of a Matrix are Circular Rotations of Each Other471
155Longest Common Prefix using Divide and Conquer469
156Find nth node of the Linked list from the end466
157Find a Fixed Point in a Given Array464
158Sort 0s 1s and 2s in an Array458
159Print all interleavings of given two strings457
160Compare Two Version Numbers456
161Reverse words in a given string455
162Merge two sorted linked lists such that merged list is in reverse order454
163Find the Subarray of given length with Least Average453
164Reorder Array Using Given Indexes451
165Split linked list using alternate nodes450
166Median of Two Sorted Arrays LeetCode Solution450
167Print Reverse of a string (Recursion)449
168Find K Length Subarray of Maximum Average439
169Print string of odd length in ‘X’ format436
170Find Element Using Binary Search in Sorted Array433
171Swap Kth Node from beginning with Kth Node from End433
172Print all Palindromic Partitions of a String431
173Find Duplicates in an Array in Most Efficient Way428
174print all palindromic partitions421
175Maximum Length of Chain Pairs418
176Shortest Superstring Problem416
177Flatten a multilevel linked list415
178Check if String Follows Order of Characters by a Pattern or not412
179Sorting a K Sorted Array410
180Sort a String According to Another String404
181Longest Span with same Sum in two Binary Arrays II398
182Reverse a Linked List in groups395
183Find a Sorted Subsequence of size 3394
184Program to add two binary digits391
185Find the two Numbers with Odd Occurrences in an Unsorted Array390
186Recursively print all the sentences that can be formed from list of word lists389
187Longest Common Prefix Using Binary Search II385
188Reverse a Singly Linked List (Iterative/Non-Recursive)383
189Caesar Cipher378
190Rearrange a linked list in Zig-Zag378
191Check if String can Become Empty by Recursively Deleting given Substring378
192Kth Non-repeating Character377
193Pancake Sorting373
194Rotate Image by 90 degrees372
195Longest Common Prefix Word by Word Matching370
196Permutations of a Given String Using STL366
197Perfect Reversible String366
198Merging Two Sorted Arrays363
199Increasing Subsequence of Length three with Maximum Product361
200Construct a Maximum Sum Linked List out of two Sorted Linked Lists having some Common nodes361
201Find the point where a monotonically increasing function becomes positive first time361
202Find First non-repeating character in a string360
203Sort a linked list with 0s, 1s and 2s357
2041`s and 2`s complement of binary number357
205Four Elements that Sum to Given354
206List items containing all characters of a given word352
207Delete N nodes after M352
208Count Number of Occurrences in a Sorted Array350
209Longest Common Prefix using Character by Character Matching349
210Palindrome string (number)343
211Split a string343
212Minimum Characters to be Removed to Make a Binary String Alternate340
213Recursive Implementation of atoi()333
214Check if a Linked list of Strings form a Palindrome333
215Print All Distinct Elements of the Array332
216Sorting the array of strings330
217Convert a String that is Repetition of a Substring of Length K330
218Valid Parentheses LeetCode Solution328
219Even Substring Count328
220Maximum occurring character in a string327
221Find the first Repeating Number in a Given Array326
222Reverse a singly linked list recursively326
223Can we reverse a linked list in less than O(n) time ?325
224Binary Tree to Doubly linked list323
225Print Shortest Path to Print a String on Screen322
226Maximum Subarray Leetcode Solution320
227Convert string1 to string2 in one edit319
228wildcard character matching319
229Reverse a String using Stack318
230Nth Character in Concatenated Decimal String318
231Sort Elements by Frequency II317
232Lower Case To Upper Case315
233Count the number of words313
234Merge Two Sorted Arrays311
235Split Four Distinct Strings310
236Find the Lost Element From a Duplicated Array310
237Find middle of the Linked List308
238Longest Common Subsequence with Permutations306
239Count the Pairs at Same Distance as in English Alphabets301
240Matrix Chain Multiplication using Dynamic Programming297
241Next Greater Element in an Array294
242Palindrome Permutation290
243Roman to Integer Leetcode Solution286
244Find Nth Node285
245Find All Pairs With a Given Difference284
246Searching a node in a Binary Search Tree283
247Triplet from three linked lists with given sum280
248Delete a Tree280
249String(represents an integer) to value279
250Print all Possible Ways to Break a String in Bracket Form277
251Reverse a String277
252Reverse Bits275
253Word Search Leetcode Solution275
254Binary Tree274
255Delete a node under given conditions273
256How to Efficiently Implement k Stacks in a Single Array?273
257Sort an array of strings271
258Change Gender of a given String271
259Meeting Rooms II LeetCode Solution269
260Count Pairs With Given Sum269
261Number of sub-strings which recursively add up to 9268
262Longest Common Extension267
263First non Repeating Element267
264Remove middle points in a linked list of line segments266
265Toeplitz Matrix265
266Move all negative elements to one side of array265
267Longest Palindromic Substring LeetCode Solution263
268Repeated Substring Pattern263
269Remove spaces from a string262
270Min Stack259
271Shuffle a given Array258
272N queen problem258
273Number of Islands LeetCode Solution253
274Dijkstra Algorithm252
275Find, second, frequent, character252
276House Robber Leetcode Solution252
277Minimize the maximum difference between the heights250
278Cuckoo sequence program250
279Search Insert Position Leetcode Solution248
280Clone a linked list with next and random pointer (Hashing)248
281Max stack248
282Most Frequent Element in an Array248
283Sort linked which is sorted on absolute values245
284Expression Evaluation245
285KMP Algorithm243
286Subset Leetcode242
287Valid Palindrome Leetcode Solution242
288Plus One Leetcode Solution242
289Fibonacci numbers241
290Evaluation of Postfix Expression240
291Sudoku Solver240
292Min Stack Leetcode Solution240
293How to Delete a Linked List239
294Number Of 1 bits239
295Reverse words in a string239
296Word Search239
297Combination Sum Leetcode Solution237
298Merge Sorted Arrays Leetcode Solution233
299Sqrt(x) Leetcode Solution232
300Backspace String Compare232
301Set Matrix Zeroes231
302Subarray with 0 sum230
303Reversing a Queue229
304Product of array except self228
305Rabin Karp Algorithm228
306Contains Duplicate II Leetcode Solution228
307Pair of Positive Negative Values in an Array227
308Tower Of Hanoi226
309Pascal Triangle Leetcode224
310Common elements in all rows of a given matrix224
311Combination Sum224
312Integer to Roman Leetcode Solution223
313Delete middle element of a stack223
314Intersection of Two Arrays II Leetcode Solution223
315String Compression223
316Count subarrays with equal number of 1’s and 0’s221
317Minimum swaps required to bring all elements less than or equal to k together220
318Single Number Leetcode Solution219
319Add Binary Leetcode Solution218
320Arithmetic Expression Evaluation218
321Reverse individual words218
322Sliding Window Technique217
323Implementation of Deque using Doubly Linked List217
324Pow(x, n) Leetcode Solution217
325Segregate even and odd numbers217
326Find Top K (or Most Frequent) Numbers in a Stream216
327Bellman Ford Algorithm216
328Second Most Repeated Word in a Sequence216
329Construct Binary Tree from Given Inorder and Preorder Traversals216
330Count of index pairs with equal elements in an array215
331Palindrome Linked List Leetcode Solution215
332Next Permutation214
333Count Odd Numbers in an Interval Range Leetcode Solution214
334Design a stack that supports getMin() in O(1) time and O(1) extra space213
335Page Replacement Algorithms in Operating Systems213
336Minimum Value to Get Positive Step by Step Sum Leetcode Solution212
337Contains Duplicate212
338Kruskal Algorithm212
339Maximum Number of Balloons Leetcode Solution212
340Postfix to Infix Conversion211
341Third Maximum Number Leetcode Solution211
342Convex Hull Algorithm210
343Sort elements by frequency210
344Find Lucky Integer in an Array Leetcode Solution209
345K-th Smallest Element in a Sorted Matrix209
346Find sum of non-repeating elements (distinct) elements in an array209
347Find the Town Judge Leetcode Solution208
348Longest Substring Without Repeating Characters LeetCode Solution208
349Longest Common Prefix Leetcode Solution208
350Permutations Leetcode Solution208
351Group Words With Same Set of Characters207
352Sum of minimum and maximum elements of all subarrays of size k206
353Find Numbers with Even Number of Digits Leetcode Solution206
354Majority Element Leetcode Solution206
355Maximum Subarray206
356Top K Frequent Words205
357Spiral Matrix LeetCode Solution205
358Prefix to Infix Conversion205
359Number of Good Pairs Leetcode Solution204
360Sorting array using Stacks204
361Smallest Subarray with k Distinct Numbers204
362Swap Nodes in Pairs Leetcode Solutions204
363Minimum operation to make all elements equal in array204
364Scramble String204
365Count Primes Leetcode Solutions203
366First element occurring k times in an array203
367Count subarrays having total distinct elements same as original array203
368Merge Two Sorted Lists Leetcode Solutions202
369Special Number202
370Check if two arrays are equal or not202
371Evaluate Division201
372Best Time to Buy and Sell Stock  II Leetcode Solution201
373Minimum Path Sum201
374Given two unsorted arrays find all pairs whose sum is x201
375Pascal’s Triangle II Leetcode Solution201
376Search in Rotated Sorted Array Leetcode Solution200
377Power of Two Leetcode Solution200
378Fizz Buzz Leetcode199
379Find All Numbers Disappeared in an Array Leetcode Solution199
380Reverse a Number Using Stack199
381House Robber II Leetcode Solution198
382Minimum Steps to reach target by a Knight198
383Reversing the First K elements of a Queue198
384Group Anagrams198
385Unique Paths Leetcode Solution197
386Missing Number Leetcode Solution197
387Matrix Diagonal Sum Leetcode Solution197
388Maximal Square197
389Find duplicates in a given array when elements are not limited to a range197
390Maximum possible difference of two subsets of an array196
391Running Sum of 1d Array Leetcode Solution196
392Leetcode Permutations196
393Top K Frequent Elements196
394Minimum Absolute Difference Leetcode Solution196
395Huffman Coding196
396Coin Change 2 Leetcode Solution195
397Maximum Distance Between two Occurrences of Same Element in Array195
398Single Number195
399How to Implement Stack Using Priority Queue or Heap?195
400Range Sum Query 2D – Immutable Leetcode Solution194
401Max Consecutive Ones Leetcode Solution194
402Expression Contains Redundant Bracket or Not194
403Average Salary Excluding the Minimum and Maximum Salary Leetcode Solution194
404How Many Numbers Are Smaller Than the Current Number Leetcode Solution194
405Sort Array by Increasing Frequency Leetcode Solution194
406Check if Array Contains Contiguous Integers With Duplicates Allowed194
407Find The Duplicate Number193
408Sorting using trivial hash function193
409Remove Duplicates from Sorted Array Leetcode Solution193
410Zigzag Conversion193
411Find Minimum In Rotated Sorted Array193
412Subarray Sum Equals k193
413Find Number of Employees Under every Employee192
414Unique Paths192
415Find the Closest Palindrome number192
416Subarray Sum Equals K LeetCode Solution192
417Reverse Vowels of a String Leetcode Solution192
418Length of the largest subarray with contiguous elements192
419Sort Integers by The Number of 1 Bit Leetcode Solution192
420Decode String192
421Convert String To Int191
422Subtract the Product and Sum of Digits of an Integer Leetcode Solution191
423Happy Number Leetcode Solution191
424Find Winner on a Tic Tac Toe Game Leetcode Solution191
425Fibonacci Number LeetCode Solution191
426Smallest Element Repeated Exactly K Times191
427Monotonic Array LeetCode Solution190
428Find Median from data Stream190
429Shuffle the Array Leetcode Solution190
430Subset sum problem190
431Reverse Integer190
432Delete a Node from linked list without head pointer189
433Cumulative Frequency of Count of Each Element in an Unsorted Array189
434Nth Catalan Number189
435Difference between highest and least frequencies in an array189
436Best Time to Buy and Sell Stock III Leetcode Solution189
437Implement Stack and Queue using Deque189
438Maximum Depth of Binary Tree Leetcode Solution188
439Trapping Rain Water Leetcode Solution188
440Check If N and Its Double Exist Leetcode Solution188
441Palindrome Substring Queries188
442LRU Cache Implementation188
443Find top three repeated in array188
444Count Substrings with equal number of 0s, 1s and 2s188
445Letter Case Permutation188
446Print All Distinct Elements of a Given Integer Array187
447The K Weakest Rows in a Matrix Leetcode Solution187
448Subarrays with distinct elements187
449Generate a String With Characters That Have Odd Counts Leetcode Solution187
450Minimum Moves to Equal Array Elements Leetcode Solution187
451Reverse Words in a String III LeetCode Solution187
452Find all pairs (a, b) in an array such that a % b = k186
453Integer to English words186
454Capacity To Ship Packages Within D Days Leetcode Solution186
455Find the first repeating element in an array of integers186
456Kth largest element in an Array Leetcode Solutions186
457Find the Duplicate Element186
458Priority Queue Using Singly Linked List186
459Sort a stack using recursion186
460Bipartite Graph185
461Word Ladder LeetCode Solution185
462Next Greater Element I Leetcode Solution185
463Iterative Tower of Hanoi185
464Sorting a Queue without Extra Space185
465Reverse a Stack Using Recursion185
466Excel Sheet Column Number Leetcode Solution185
467Find Common Characters Leetcode Solution184
468Concatenation of Array LeetCode Solution184
469Count pairs from two linked lists whose sum is equal to a given value184
470Prim’s Algorithm184
471Merge Two Sorted Linked Lists184
472Longest Common Subsequence183
473Find the Difference Leetcode Solution183
474Find First and Last Position of Element in Sorted Array Leetcode Solution183
475Merge Overlapping Intervals183
476Edit Distance183
477Floyd Warshall Algorithm183
478Multiply Strings Leetcode Solution183
479Balanced Binary Tree Leetcode Solution183
480Reverse a String183
481Print all subarrays with 0 sum182
482Find elements which are present in first array and not in second182
483Kth Largest Element in a Stream Leetcode Solution182
484Flood Fill LeetCode182
485Sum of Subarray Ranges Leetcode Solution182
486Move Zeroes LeetCode Solution182
487Slowest Key Leetcode Solution182
488Kids With the Greatest Number of Candies Leetcode Solution182
489Number of Steps to Reduce a Number to Zero Leetcode Solution181
490MiniMax Algorithm181
491Top View of Binary Tree181
492Fizz Buzz181
493Remove Minimum Number of Elements Such That no Common Element Exist in both Array181
494Count and Say181
495Degree of an array181
496Text Justification LeetCode Solution181
497Target Sum181
498Reverse a linked list180
499Longest Common Prefix using Trie180
500Zigzag Conversion LeetCode Solution180
501Peak Index in a Mountain Array179
502Design Parking System Leetcode Solution179
503Convert array into Zig-Zag fashion179
504Jump Game Leetcode Solution179
505Find subarray with given sum (Handles Negative Numbers)179
506Pair with given product178
507Max Area of Island178
508Intersection of Two Arrays178
509Count and Say Leetcode Solution178
510Longest subarray not having more than K distinct elements178
511Priority Queue in C++177
512Postfix to Prefix Conversion177
513Find N Unique Integers Sum up to Zero Leetcode Solution177
514The Stock Span Problem177
515Length of Last Word Leetcode Solution177
516Find four elements that sum to a given value (Hashmap)177
517Check if a given array contains duplicate elements within k distance from each other177
518Last Stone Weight177
519Valid Parenthesis String177
520Find Index of Closing Bracket for a Given Opening Bracket in an Expression176
521Koko Eating Bananas Leetcode Solution176
522Prefix to Postfix Conversion176
523Substring With Concatenation Of All Words176
524Shortest Palindrome176
525Relative Sort Array Leetcode Solution176
526Contiguous Array Leetcode176
527Find missing elements of a range176
528Shuffle String Leetcode Solution176
529Delete Node in a Linked List Leetcode Solution175
530Find distinct elements common to all rows of a matrix175
531Longest Common Prefix using Sorting175
532Largest Perimeter Triangle Leetcode Solution175
533Mobile Numeric Keypad Problem175
534Implementation of Deque using circular array174
535K-th Distinct Element in an Array174
536Find any one of the multiple repeating elements in read only array174
537Best Time to Buy and Sell Stock174
538Smallest Subarray With all Occurrences of a Most Frequent Element174
539Implement a stack using single queue174
541Count number of triplets with product equal to given number174
542N-th Tribonacci Number Leetcode Solution174
543Iterative Inorder Traversal of a Binary Tree174
544Is Subsequence Leetcode Solution174
545Hamming Distance173
546Maximum sum rectangle in a 2D matrix173
547Valid Anagrams173
548Container with Most Water173
549Valid Sudoku173
550Isomorphic Strings Leetcode Solution173
551Implement Stack using Queues173
55201 Matrix LeetCode Solution173
553Minimum Operations to convert X to Y173
554Excel Sheet Column Title Leetcode Solution173
555Jewels and Stones Leetcode Solution173
556Build Array From Permutation Leetcode Solution173
557First negative integer in every window of size k173
558Linked List Cycle II LeetCode Solution172
559Shuffle an Array172
560Distribute Candies to People Leetcode Solution172
561Sum of Left Leaves Leetcode Solutions172
562Island Perimeter Leetcode Solution172
563Next Greater Frequency Element172
564Convert Sorted Array to Binary Search Tree Leetcode Solution172
565Minimum Delete Operations to make all Elements of Array Same171
566Remove Linked List Elements Leetcode Solution171
567Find Words That Can Be Formed by Characters Leetcode Solution171
568Find the smallest positive integer value that cannot be represented as sum of any subset of a given array171
569Convert a normal BST to Balanced BST171
570Arrange given numbers to form the biggest number171
571Trapping Rain Water LeetCode Solution171
572Minimum Bracket Reversals170
573Rearrange a binary string as alternate x and y occurrences170
574Count the number of nodes at given level in a tree using BFS170
575Gold Mine Problem170
576Insert Interval Leetcode Solution170
577Count all subsequences having product less than K170
578Assign Cookies Leetcode Solution170
579Integer to Roman169
580LRU Cache LeetCode Solution169
581Check for Balanced Parentheses in an Expression169
582Maximum path sum in a triangle169
583Rotate Image LeetCode Solution169
584Change the Array into Permutation of Numbers From 1 to N169
5853Sum Closest LeetCode Solution169
586Group Multiple Occurrence of Array Elements Ordered by first Occurrence169
587Shortest Path in a Grid with Obstacles Elimination LeetCode Solution169
588The Knapsack Problem169
589Summary Ranges Leetcode Solution168
590Permutation in String Leetcode Solution168
591Minimum Knight Moves LeetCode Solution168
592Minimum number of distinct elements after removing m items168
593Rotate List Leetcode Solution168
594Maximum Distance in Array167
595Same Tree LeetCode Solution167
596K Empty Slots LeetCode167
597Distance Between Bus Stops Leetcode Solution167
598How to check if two given sets are disjoint?167
599Sieve of Eratosthenes167
600Combinations Leetcode Solution167
601XOR Operation in an Array Leetcode Solution167
602Decode Ways167
603Segregate 0s and 1s in an Array167
604Unique Binary Search Trees167
605Remove All Occurrences of a Substring LeetCode Solution166
606Printing brackets in Matrix Chain Multiplication Problem166
607Find if an Expression has Duplicate Parenthesis or Not166
608Sort Characters By Frequency LeetCode Solution166
609Maximum Number of Chocolates to be Distributed Equally Among k Students166
610License Key Formatting Leetcode Solution166
611Replace Elements with Greatest Element on Right Side Leetcode Solution165
612Frog Jump Leetcode Solution165
613Find Sum of all unique sub-array sum for a given array165
614Find the Duplicate Number LeetCode Solution165
615Stone Game LeetCode165
616Maximum difference between first and last indexes of an element in array165
617Find minimum difference between any two elements165
618Sort Array By Parity LeetCode Solution165
619Minimum number of subsets with distinct elements165
620Word Pattern165
621Best Time to Buy and Sell Stock LeetCode Solution165
622Minimum insertions to form a palindrome with permutations allowed164
623Painting Fence Algorithm164
624Word Wrap Problem164
625Applications of Breadth First Search and Depth First Search164
626Minimum Depth of Binary Tree Leetcode Solution163
627Defanging an IP Address Leetcode Solution163
628Check If It Is a Straight Line Leetcode Solution163
629Longest Substring with At Most K Distinct Characters LeetCode Solution163
630Tracking current Maximum Element in a Stack163
631Distance of nearest cell having 1 in a binary matrix163
632Smallest Good Base163
633Binary Tree Zigzag Level Order Traversal LeetCode Solution162
634Maximum Consecutive Numbers Present in an Array162
635Find Maximum Level sum in Binary Tree162
636Find pairs with given sum such that elements of pair are in different rows162
637Valid Palindrome II Leetcode Solution162
638House Robber162
639Kth Missing Positive Number Leetcode Solution162
640Non-overlapping sum of two sets162
641Coin Change Problem162
642Minimum Cost to Hire K Workers162
643Isomorphic Strings162
644Iterative Method to find Height of Binary Tree161
645Letter Combinations of a Phone Number161
646Rearrange an array in order – smallest, largest, 2nd smallest, 2nd largest161
647Count Good Nodes in Binary Tree Leetcode Solution161
648GCD Of Two Numbers161
649Merge Two Balanced Binary Search Trees160
650Longest Increasing Subsequence160
651Reverse a stack without using extra space in O(n)160
652Delete consecutive same words in a sequence160
653Minimum Number of Steps to Make Two Strings Anagram Leetcode Solutions160
654Best Time to Buy and Sell Stock with Cooldown Leetcode Solution160
655Queries for counts of array elements with values in given range160
656Employee Free Time LeetCode Solution160
657Optimal Account Balancing LeetCode Solution160
658Power of Four Leetcode Solution160
659Sum of All Odd Length Subarrays Leetcode Solution160
660Check If Two String Arrays are Equivalent Leetcode Solution159
661Number of Provinces Leetcode Solution159
662K Empty Slots159
663Convert an array to reduced form159
664Moving Average from Data Stream Leetcode Solution159
665Ugly Number Leetcode Solution159
666Number of Dice Rolls With Target Sum LeetCode Solution159
667BFS vs DFS for Binary Tree159
668Maximum Number of Coins You Can Get Leetcode Solution159
669Reducing Dishes LeetCode Solution158
670Check if a queue can be sorted into another queue using a stack158
671Largest Sum Contiguous Subarray158
672Form minimum number from given sequence158
673Path With Maximum Minimum Value LeetCode Solution158
674Wiggle Sort158
675Strobogrammatic Number LeetCode Solution158
676Reverse Only Letters LeetCode Solution158
677Longest Substring with At Least K Repeating Characters LeetCode Solution158
678Longest Increasing Path in a Matrix LeetCode Solution158
679String to Integer (atoi) LeetCode Solution158
680Print the Fibonacci numbers in reverse order158
681Flipping an Image LeetCode Solution158
682Construct BST from given Preorder Traversal157
683Find the Distance Value Between Two Arrays Leetcode Solution157
684Binary Tree zigzag level order Traversal157
685Sum of f(a[i], a[j]) over all pairs in an array of n integers157
686Lucky Numbers in a Matrix Leetcode Solution157
687Reversing a Queue using Recursion157
688Find the Smallest Divisor given a Threshold Leetcode Solution157
689How to Create Mergable Stack?157
690Increasing Decreasing String Leetcode Solution157
691Valid Perfect Square Leetcode Solution157
692Find Largest d in Array such that a + b + c = d157
693Inorder Successor of a node in Binary Tree157
694Find Leaves of Binary Tree LeetCode Solution157
695Reorganize String157
696Partition Labels LeetCode Solution157
697To Lower Case Leetcode Solution157
698Robot Room Cleaner Leetcode Solution157
699Subset Sum Leetcode157
700Unique Paths II Leetcode Solution157
701Delete Nth node from the end of the given linked list157
702Permutation Sequence LeetCode Solution157
703Merge Two Binary Trees LeetCode Solution156
704Valid Palindrome156
705Find whether an array is subset of another array156
706Dynamic Programming Basics156
707Reservoir Sampling156
708Recover Binary Search Tree156
709Remove Invalid Parentheses Leetcode Solution156
710Partition Array Into Three Parts With Equal Sum Leetcode Solution156
711Maximum Number of Occurrences of a Substring Leetcode Solution156
712Convert a Number to Hexadecimal Leetcode Solution155
713Maximum Product of Two Elements in an Array Leetcode Solution155
714Edit Distance LeetCode Solution155
715Populating Next Right Pointers in Each Node155
716Find the node with minimum value in a Binary Search Tree155
717Restore IP Addresses Leetcode Solution155
718Sort Array by Increasing Frequency Leetcode Solution155
719Keyboard Row Leetcode Solution155
720Majority Element II Leetcode Solution155
721Rank Transform of an Array Leetcode Solution154
722Search a 2D Matrix II Leetcode Solution154
723Maximum Product of Three Numbers LeetCode Solution154
724Add and Search Word – Data structure design LeetCode154
725Hamming Distance Leetcode Solution154
726Decompress Run-Length Encoded List Leetcode Solution154
727String Compression LeetCode Solution153
728Find the largest multiple of 3153
729Minimum Distance Between BST Nodes Leetcode Solution153
730Stack Permutations (Check if an array is stack permutation of other)153
731Numbers with prime frequencies greater than or equal to k153
732Finding K closest element153
733Factorial Trailing Zeroes Leetcode Solution153
734Evaluate Reverse Polish Notation LeetCode Solution153
735Symmetric Tree Leetcode Solution153
736Maximum 69 Number Leetcode Solution152
737Bulb Switcher LeetCode Solution152
738Deletion in a Binary Tree152
739Largest subarray with equal number of 0s and 1s152
740Queue based approach for first non-repeating character in a stream152
741Search in a Binary Search Tree Leetcode Solution152
742Minimum Height Trees152
743Binary Tree Maximum Path Sum LeetCode Solution152
744Longest Span with same Sum in two Binary arrays152
745Minimum Cost For Tickets Leetcode Solution152
746Find unique character in a string152
747Sorted Linked List to Balanced BST152
748Find Median from Data Stream LeetCode Solution152
749Best Meeting Point LeetCode Solution152
750Linked List Cycle151
751Split a String in Balanced Strings Leetcode Solution151
752Perform String Shifts Leetcode151
753Race Car LeetCode Solution151
754Find All Duplicates in an Array LeetCode Solution151
755Elements to be added so that all elements of a range are present in array151
756Remove Duplicates from Sorted List LeetCode Solution151
757Snakes and Ladders LeetCode Solution151
758Non-decreasing Array LeetCode Solution151
759Maximum Length of a Concatenated String with Unique Characters Leetcode Solution151
760Invert Binary Tree LeetCode Solution151
761Word Pattern LeetCode Solution151
762Check If Array Pairs Are Divisible by k LeetCode Solution151
763Generate all possible sorted arrays from alternate elements of two given sorted arrays151
764Binomial Coefficient151
765Find Maximum Depth of Nested Parenthesis in a String151
766Student Attendance Record I Leetcode Solution151
767Merge K Sorted Linked Lists151
768Find Pair with Greatest Product in Array150
769Remove Nth Node From End of List Leetcode Solution150
770Diagonal Traversal of Binary Tree150
771Count quadruples from four sorted arrays whose sum is equal to a given value x150
772Minimize Maximum Pair Sum in Array LeetCode Solution150
773Number of Islands II LeetCode Solution150
774Bubble sort using two Stacks150
775First Unique Character in a String LeetCode Solution150
776k-th missing element in increasing sequence which is not present in a given sequence150
777N-Queens LeetCode Solution150
778Largest Rectangle in Histogram LeetCode Solution150
779Maximum Difference Between Increasing Elements LeetCode Solution150
780Maximum Depth of N-ary Tree Leetcode Solution150
781Find if Path Exists in Graph Leetcode Solution150
782Final Prices With a Special Discount in a Shop Leetcode Solution149
783Growable array based stack149
784Largest rectangular sub-matrix whose sum is 0149
785Minimum number of jumps to reach end149
786Morris Traversal149
787Kth ancestor of a node in binary tree149
788Transpose Graph149
789Jump Game149
790Nested List Weight Sum II LeetCode Solution148
791Sort an array according to the order defined by another array148
792Minimum time required to rot all oranges148
793Minimum Jumps to Reach Home LeetCode Solution148
794Crawler Log Folder Leetcode Solution148
795Interval Tree148
796Valid Number148
797Number Complement Leetcode Solution148
798Minimum Time Visiting All Points Leetcode Solution148
799Check for Palindrome after every character replacement Query148
800Relative Ranks Leetcode Solution148
801Tiling Problem148
802Merge Sorted Array LeetCode Solution148
803Remove brackets from an algebraic string containing + and – operators148
804Special Array With X Elements Greater Than or Equal X Leetcode Solution148
805Program for Bridge and Torch problem148
806Maximum size subarray sum equals k147
807Print a Binary Tree in Vertical Order147
808Regular Expression Matching147
809Nearest Exit from Entrance in Maze LeetCode Solution147
810Subarray Product Less Than K LeetCode Solution147
811One Edit Distance LeetCode Solution147
812Total Numbers With no Repeated Digits in a Range147
813Sort Array By Parity II Leetcode Solution147
814Count items common to both the lists but with different prices147
815Get Maximum in Generated Array Leetcode Solution147
816Check if Two Expressions With Brackets are Same147
817Number of NGEs to the Right147
818Alien Dictionary LeetCode Solution147
819Remove Duplicates from Sorted List II147
820Sort Colors146
821Base 7 Leetcode Solution146
822Make Two Arrays Equal by Reversing Sub-arrays Leetcode Solution146
823Longest Subarray Having Count of 1s One More than Count of 0s146
824Circular Queue146
825Priority Queue using doubly linked list146
826Minimum Number of Taps to Open to Water a Garden LeetCode Solution146
827String comparison containing wildcards146
828A Space Optimized DP solution for 0-1 Knapsack Problem146
829Reorder Data in Log Files LeetCode Solution146
830Partition to K Equal Sum Subsets Leetcode Solution146
831Maximum Profit in Job Scheduling Leetcode Solution146
832Convert BST to Min Heap146
833Friends Pairing Problem146
834Can Place Flowers LeetCode Solution145
835Partition List Leetcode Solution145
836Clone Graph LeetCode Solution145
837Brightest Position on Street LeetCode Solution145
838Path with maximum average value145
839Subsequence of Size K With the Largest Even Sum LeetCode Solution145
840Minimum swaps to make sequences increasing145
841Check if a given array can represent Preorder Traversal of Binary Search Tree145
842Sorted Array to Balanced BST145
843Top K Frequent Words LeetCode Solution145
844Find the subarray with least average145
845Maximum Nesting Depth of the Parentheses Leetcode Solution144
846Find the Only Repetitive Element Between 1 to N-1144
847Last Stone Weight II LeetCode Solution144
848Minimum Sum Path in a Triangle144
849Three way partitioning of an array around a given range144
850Guess Number Higher or Lower LeetCode Solution144
851Course Schedule II – LeetCode144
852Level order Traversal in Spiral Form144
853Design a Stack With Increment Operation Leetcode Solution144
854Given an Array of Pairs Find all Symmetric Pairs in it144
855Iterative Preorder Traversal144
856Insert into a Binary Search Tree Leetcode Solution144
857Minimum Swaps to Make Strings Equal Leetcode Solution144
858Valid Parentheses Leetcode Solution144
859Count Distinct Elements in Every Window of Size K144
860Check if an Array is Stack Sortable144
861Union and Intersection of two Linked Lists143
862Brick Wall LeetCode Solution143
863Water Bottles Leetcode Solution143
864Sum of nearest smaller and greater number143
865Repeated Substring Pattern LeetCode Solution143
866Subset with sum divisible by m143
867Permutation Coefficient143
868Find all triplets with zero sum143
869Count Negative Numbers in a Sorted Matrix LeetCode Solution142
870Form Minimum Number From Given Sequence142
871Check whether a given Binary Tree is Complete or not142
872Rearrange Spaces Between Words Leetcode Solution142
873Spiral Matrix II Leetcode Solution142
874Daily Temperatures Leetcode Solution142
875Binary Search Tree Search and Insertion142
876Best Time to Buy and Sell Stock with Transaction Fee Leetcode Solution142
877Find All Possible Recipes from Given Supplies LeetCode Solution142
878Least Number of Unique Integers after K Removals Leetcode Solution142
879Range sum queries without updates142
880Destination City Leetcode Solution142
881Robot Bounded In Circle LeetCode Solution142
882Lemonade Change Leetcode Solution142
883Tree Traversal (Preorder, Inorder & Postorder)142
884An Interesting Method to generate Binary Numbers from 1 to n141
885GCDs of given index ranges in an array141
886Design Browser History LeetCode Solution141
887Queries for GCD of all numbers of an array except elements in a given range141
888Matrix Chain Multiplication141
890Count ways to reach the nth stair using step 1, 2 or 3141
891Identify and Mark Unmatched Parenthesis in an Expression141
892LCS (Longest Common Subsequence) of three strings141
893Balanced Expression with Replacement141
894Number of Days Between Two Dates LeetCode Solution141
895Missing Element in Sorted Array LeetCode Solution141
896Construct Complete Binary Tree from its Linked List Representation140
897Sequences of given length where every element is more than or equal to twice of previous140
898Find all permuted rows of a given row in a matrix140
899Special Positions in a Binary Matrix Leetcode Solution140
900Diagonal Traversal LeetCode Solution140
901Shortest Word Distance Leetcode Solution140
902Insert Delete GetRandom140
903Distinct adjacent elements in an array140
904Time Based Key-Value Store LeetCode Solution140
905BFS for Disconnected Graph140
906Check if the given array can represent Level Order Traversal of Binary Search Tree140
907Count Subarrays with Same Even and Odd Elements140
908Delete And Earn140
909Guess Number Higher or Lower II140
910Maximum Score After Splitting a String Leetcode Solution140
911Find Maximum Sum Possible Equal Sum of Three Stacks140
912Minimum sum of multiplications of n numbers139
913Palindrome Partitioning Leetcode Solution139
914Diagonal Traverse LeetCode Solution139
915Rearrange an Array Such that arr[i] is equal to i139
916Set Matrix Zeroes Leetcode Solution139
917A program to check if a binary tree is BST or not139
918Alien Dictionary139
919Intersection of Two Linked Lists LeetCode Solution139
920Convert Sorted List to Binary Search Tree139
921Check if stack elements are pairwise consecutive139
922Remove Duplicates from Sorted List II LeetCode Solution139
923Number of Distinct Islands Leetcode Solution138
924Find distance between two nodes of a Binary Tree138
925Find Common Characters Leetcode Solution138
926Maximum Frequency Stack Leetcode Solution138
927K’th Largest Element in BST when modification to BST is not allowed138
928Merge Two Sorted Lists Leetcode138
929Range LCM Queries138
930Print Fibonacci sequence using 2 variables138
931Analyze User Website Visit Pattern LeetCode Solution138
932Rearrange Array such that arr[i] >= arr[j] if i is even and arr[i] <= arr[j] if i is odd and j < i138
933Vertical sum in a given binary tree138
934Longest Palindromic Subsequence138
935Merging Intervals137
936Can Make Arithmetic Progression From Sequence Leetcode Solution137
9373 Sum137
938Spiral Matrix III LeetCode Solution137
939All Unique Triplets that Sum up to a Given Value137
940Strongly Connected Component137
941Stone Game II Leetcode137
942Three Consecutive Odds Leetcode Solution137
943Lexicographical Numbers Leetcode Solution136
944Count Submatrices With All Ones LeetCode Solution136
945Minimum Height Trees LeetCode Solution136
946Maximum Subarray Sum Excluding Certain Elements136
947Largest area rectangular sub-matrix with equal number of 1’s and 0’s136
948Infix to Postfix136
949Construct the Rectangle Leetcode Solution136
950Trim a Binary Search Tree136
951Maximize Sum of Array after K Negations Leetcode Solution136
952Number of Equivalent Domino Pairs Leetcode Solution136
953Word Break136
954Sliding Window Maximum136
955Averages of Levels in Binary Tree136
956Queue using Stacks136
957Breadth First Search (BFS) for a Graph135
958Binary Tree Longest Consecutive Sequence LeetCode Solution135
959Reverse Nodes in K-Group135
960Check if any two intervals overlap among a given set of intervals135
961Difference Array | Range update query in O(1)135
962Iterative Postorder Traversal Using Two Stacks135
963Dividing Array into Pairs With Sum Divisible by K135
964Median of Two Sorted Arrays135
965Count Primes in Ranges135
966Construct BST from its given Level Order Traversal135
967Binary array after M range toggle operations135
968Pattern Occurrences using Stack135
969Find postorder traversal of BST from preorder traversal135
970Check If a Word Occurs As a Prefix of Any Word in a Sentence Leetcode Solution134
971Newman-Conway Sequence134
972Split Array Into Consecutive Subsequences134
973Height of a generic tree from parent array134
974Palindrome Partitioning134
975Asteroid Collision LeetCode Solution134
976Create Maximum Number134
977Minesweeper LeetCode Solution134
978Find Maximum of Minimum for Every Window Size in a Given Array134
979Symmetric Tree134
980Maximum Product Subarray134
981Largest divisible pairs subset134
982Largest Substring Between Two Equal Characters Leetcode Solution134
983Kill Process LeetCode Solution133
984Serialize and Deserialize Binary Tree133
985Find Duplicate Subtrees133
986First missing positive133
987Depth First Search (DFS) for a Graph133
988Length of Longest Fibonacci Subsequence133
989Maximum subsequence sum such that no three are consecutive133
990Count pair with Given Sum133
991Sign of the Product of an Array LeetCode Solution133
992Rearrange array such that even positioned are greater than odd133
993K Closest Points to Origin Leetcode Solution133
994Binary Search Tree Delete Operation133
995Product of Array Except Self LeetCode Solution133
996Segment Tree133
997The Maze III LeetCode Solution133
998Kth Smallest Element in a BST Leetcode Solution133
999Shuffle 2n integers as without using extra space133
1000Next Greater Element III LeetCode Solution132
1001Find the First Circular Tour that visits all the Petrol Pumps132
1002Climbing stairs132
1003The Painter’s Partition Problem132
1004Boundary Traversal of binary tree132
1005Find number of pairs in an array such that their XOR is 0132
1006My Calendar I LeetCode Solution132
1007Find the Difference Leetcode Solution132
1008Graph Valid Tree LeetCode Solution132
1009Maximum Number of Ways to Partition an Array LeetCode Solution132
1010Unique Paths II132
1011Level Order Traversal of Binary Tree132
1012Level order traversal using two Queues131
1013Count subarrays where second highest lie before highest131
1014Advantages of BST over Hash Table131
1015Morris Inorder Traversal131
1016Partition Equal Subset Sum131
1017Build an Array With Stack Operations Leetcode Solution131
1018Decrypt String from Alphabet to Integer Mapping Leetcode Solution131
1019Make The String Great Leetcode Solution131
1020Balanced Binary Tree131
1021Longest Nice Substring LeetCode Solution131
1022Collect maximum points in a grid using two traversals131
1023Longest subsequence such that difference between adjacents is one131
1024Friends Of Appropriate Ages LeetCode Solution131
1025Largest Number Leetcode Solution131
1026Design Hit Counter LeetCode Solution131
1027Double the first element and move zero to end131
1028Insertion in a Binary Tree130
1029Boolean Parenthesization Problem130
1030Super Ugly Number130
1031Ugly Numbers130
1032Shortest Completing Word Leetcode Solution130
1033Valid Boomerang Leetcode Solution130
1034Maximum Length of Repeated Subarray130
1035Recover Binary Search Tree Leetcode Solution129
1036Rearrange an array such that ‘arr[j]’ becomes ‘i’ if ‘arr[i]’ is ‘j’129
1037Ugly Number II LeetCode Solution129
1038Binary Search Tree129
1039Available Captures for Rook Leetcode Solution129
1040Employee Importance LeetCode Solution129
1041String Matching in an Array Leetcode Solution129
1042Count minimum steps to get the given desired array129
1043Number Of Longest Increasing Subsequence129
1044Compute nCr % p129
1045Maximum length subsequence with difference between adjacent elements as either 0 or 1128
1046Maximum Product of Indexes of Next Greater on Left and Right128
1047Maximum Sum of 3 Non-Overlapping Subarrays128
1048Construction of Longest Increasing Subsequence (N log N)128
1049Minimum Size Subarray Sum128
1050Number of palindromic paths in a matrix128
1051Invalid Transactions LeetCode Solution128
1052Kth Smallest Element in a Sorted Matrix LeetCode Solution128
1053Generate Parentheses Leetcode Solution128
1054Construct Binary Tree from given Parent Array representation128
1055Defanging an IP Address LeetCode Solution128
1056Move all negative elements to end in order with extra space allowed128
1057Scramble String LeetCode Solution128
1058Implement Trie (Prefix Tree) Leetcode Solution128
1059Longest Bitonic Subsequence128
1060Validate Binary Search Tree128
1061Find Peak Element127
1062Maximum weight transformation of a given string127
1063Iterative Depth First Traversal of Graph127
1064Populating Next Right Pointers in Each Node Leetcode Solution127
1065Determine Whether Matrix Can Be Obtained By Rotation LeetCode Solution127
1066Increasing Triplet Subsequence LeetCode Solution127
1067Regular Expression Matching Regular Expression Matching LeetCode Solution127
1068Minimum Index Sum of Two Lists127
1069Find whether a subarray is in form of a mountain or not127
1070Combination Sum IV LeetCode Solution127
1071Clone a Binary Tree with Random Pointers127
1072Add two numbers127
1073Maximum difference between frequency of two elements such that element having greater frequency is also greater127
1074Remove Duplicates from Sorted Array II Leetcode Solution126
1075Number of Closed Islands Leetcode Solution126
1076Bitwise AND of Numbers Range LeetCode Solution126
1077Lowest Common Ancestor126
1078Find a Peak Element II LeetCode Solution126
1079Remove Palindromic Subsequences Leetcode Solution126
1080Day of the Year Leetcode Solution126
1081Smallest Common Region Leetcode Solution126
1082Divisible Pairs Counting126
1083Find the minimum distance between two numbers126
1084Path Sum II LeetCode Solution126
1085Binary Tree Right Side View LeetCode Solution126
1086Count pairs from two sorted arrays whose sum is equal to a given value x126
1087Custom Sort String Leetcode Solution126
1088Maximize Distance to Closest Person LeetCode Solution126
1089Rearrange array such that even index elements are smaller and odd index elements are greater125
1090Kth Smallest Product of Two Sorted Arrays LeetCode Solution125
1091Search in Sorted Rotated Array125
1092Next Permutation Leetcode Solution125
1093Largest BST Subtree LeetCode Solution125
1094Binary Tree Data Structure125
1095Number of siblings of a given Node in n-ary Tree125
1096Path Sum125
1097Serialize and Deserialize Binary Tree LeetCode Solution125
1098Find maximum difference between nearest left and right smaller elements124
1099Print all triplets in sorted array that form AP124
1100Find Smallest Range Containing Elements from k Lists124
1101Subarrays with K Different Integers Leetcode Solution124
1102Write Code to Determine if Two Trees are Identical124
1103Distinct Subsequences124
1104Number of Students Doing Homework at a Given Time Leetcode Solution124
1105Types of Binary Tree124
1106Print Next Greater Number of Q queries124
1107Consecutive Characters LeetCode Solution124
1108Level of Each node in a Tree from source node124
1109Find Three Element From Different Three Arrays Such That a + b + c = sum124
1110Topological Sorting123
1111Cutting a Rod123
1112Construct Binary Tree from Preorder and Postorder Traversal LeetCode Solution123
1113Bottom View of a Binary Tree123
1114Third Maximum Number Leetcode Solution123
1115Minimum Absolute Difference in BST Leetcode Solution123
1116Cells with Odd Values in a Matrix LeetCode Solution122
1117Reformat The String Leetcode Solution122
1118Root to Leaf path with target sum Leetcode Solutions122
1119Constant time range add operation on an array122
1120Remove duplicates from sorted array122
1121Maximum Binary Tree122
1122Print Right View of a Binary Tree122
1123Longest Subarray of 1’s After Deleting One Element LeetCode Solution122
1124Convert BST into a Min-Heap without using array122
1125Queries for Number of Distinct Elements in a Subarray122
1126Maximum Product Subarray122
1127Count Largest Group Leetcode Solution121
1128Print modified array after executing the commands of addition and subtraction121
1129Valid Tic-Tac-Toe State LeetCode Solution121
1130Minimum Score Triangulation of Polygon Leetcode Solution121
1131Diameter of N-Ary Tree LeetCode Solution121
1132Closest Binary Search Tree Value Leetcode Solution121
1133Search an Element in Sorted Rotated Array121
1134Mean of Array After Removing Some Elements Leetcode Solution121
1135Thousand Separator Leetcode Solution120
1136Minimum sum of squares of character counts in a given string after removing k characters120
1137Prime Palindrome LeetCode Solution120
1138Palindrome Permutation LeetCode Solution120
1139Iterative method to find ancestors of a given binary tree120
1140Products of ranges in an array120
1141Golomb sequence120
1142Construct K Palindrome Strings LeetCode Solution120
1143Search Insert Position120
1144Sum of Even Numbers After Queries120
1145Find a sorted subsequence of size 3 in linear time119
1146Kth Smallest Number in Multiplication Table Leetcode Solution119
1147Merge two BSTs with limited extra space119
1148Longest Increasing Consecutive Subsequence119
1149Red-Black Tree Introduction119
1150Moser-de Bruijn Sequence119
1151Factorial Trailing Zeroes LeetCode Solution119
1152Possible Bipartition LeetCode Solution118
1153Delete Nodes and Return Forest Leetcode Solution118
1154Swapping Nodes in a Linked List Leetcode Solution118
1155Transform a BST to Greater sum Tree118
1156Binary Tree to Binary Search Tree Conversion118
1157Find Two Non-overlapping Sub-arrays Each With Target Sum LeetCode Solution118
1158Bus Routes Leetcode Solution118
1159Subset Sum Problem in O(sum) space118
1160Find maximum length Snake sequence118
1161Maximum Product of Splitted Binary Tree LeetCode Solution118
1162Compare Strings by Frequency of the Smallest Character Leetcode Solution118
1163Palindromic Substrings Leetcode Solution117
1164Swap Nodes In Pairs117
1165K maximum sums of overlapping contiguous sub-arrays117
1166Number of Orders in the Backlog Leetcode Solution117
1167Count even length binary sequences with same sum of first and second half bits117
1168Minimum Sideway Jumps LeetCode Solution117
1169Maximize sum of consecutive differences in a circular array117
1170Check Array Formation Through Concatenation Leetcode Solution117
1171K’th Largest element in BST using constant extra space117
1172Decision Tree117
1173Minimum Cost to Move Chips to The Same Position LeetCode Solution117
1174Longest Repeated Subsequence117
1175Find the smallest binary digit multiple of given number117
1176Priority Queue116
1177Count Pairs Whose Products Exist in Array116
1178Minimum Moves to Equal Array Elements LeetCode Solution116
1179Web Crawler LeetCode Solution116
1180Rotate Array116
1181Matchsticks to Square Leetcode Solution115
1182Decrease Elements To Make Array Zigzag LeetCode Solution115
1183First Bad Version115
1184Closest Leaf in a Binary Tree LeetCode Solution115
1185Find Largest Value in Each Tree Row LeetCode Solution115
1186Search Suggestions System LeetCode Solution115
1187Remove Max Number of Edges to Keep Graph Fully Traversable Leetcode Solution114
1188Given a binary tree, how do you remove all the half nodes?114
1189Moving Stones Until Consecutive Leetcode Solution114
1190Queue Reconstruction by Height114
1191Contiguous Array LeetCode Solution114
1192Convert Sorted Array to Binary Search Tree LeetCode Solutions113
1193Lowest Common Ancestor in Binary Search Tree113
1194Maximum sum bitonic subarray113
1195How to print maximum number of A’s using given four keys113
1196Reformat Date LeetCode Solution113
1197Reverse a Path in BST using Queue113
1198Divide Two Integers Leetcode Solution113
1199Sum of Left Leaves LeetCode Solution113
1200Kth Smallest Element in a BST113
1201Maximum Depth Of Binary Tree113
1202Valid Triangle Number113
1203Maximum number of segments of lengths a, b and c113
1204Maximum sum of pairs with specific difference113
1205Array Queries for multiply replacements and product112
1206Lowest Common Ancestor of a Binary Tree Leetcode Solution112
1207Filter Restaurants by Vegan-Friendly, Price and Distance Leetcode Solution112
1208Champagne Tower LeetCode Solution112
1209Range Sum Query using Sparse Table112
1210Write a function to get the intersection point of two Linked Lists112
1211Integer Break LeetCode Solution112
1212Longest Common Prefix Using Word by Word Matching112
1213Range Queries for Longest Correct Bracket Subsequence111
1214Check Completeness of a Binary Tree LeetCode Solution111
1215Guess The Word111
1216New 21 Game111
1217Replace two consecutive equal values with one greater111
1218Convert Integer to the Sum of Two No-Zero Integers Leetcode Solution110
1219Check if each internal node of a BST has exactly one child110
1220Symmetric Tree LeetCode Solution Leetcode Solution110
1221Path Crossing Leetcode Solution110
1222Valid Perfect Square LeetCode Solution110
1223Queries on Probability of Even or Odd Number in given Ranges110
1224Concatenation of Array LeetCode Solution110
1225Print modified array after multiple array range increment operations110
1226Maximum Value at a Given Index in a Bounded Array LeetCode Solution110
1227Design Skiplist LeetCode Solution110
1228Arithmetic Slices II – Subsequence LeetCode Solution110
1229Graph and its representation110
1230Flatten 2D Vector LeetCode Solution110
1231Maximum Array from Two given Arrays Keeping Order Same109
1232Print n terms of Newman-Conway Sequence109
1233The kth Factor of n Leetcode Solution109
1234Check for Identical BSTs without building the trees109
1235Merge Sort109
1236Maximum sum of a path in a Right Number Triangle109
1237Minimum Swaps To Make Sequences Increasing LeetCode Solution109
1238LRU Cache Leetcode Solution109
1239BST to a Tree with Sum of all Smaller Keys109
1240Sliding Window Median Leetcode Solution109
1241Perfect Squares LeetCode Solution109
1242Power of Two108
1243Count Subsets Having Distinct Even Numbers108
1244Mean of range in array108
1245Check if all levels of two Binary Tree are anagrams or not108
1246Find Minimum in Rotated Sorted Array II LeetCode Solution108
1247Bold Words in String LeetCode Solution108
1248Parallel Courses II LeetCode Solution108
1249Missing Number108
1250Image Overlap LeetCode Solution107
1251Maximize Elements Using Another Array107
1252Min Cost Climbing Stairs LeetCode Solution107
1253Count and Toggle Queries on a Binary Array107
1254Contiguous Array107
1255Maximum Product Subarray107
1256Largest Plus Sign Leetcode Solution107
1257Graph Cloning107
1258Check If a String Can Break Another String Leetcode Solution106
1259Find minimum number of merge operations to make an array palindrome106
1260Verify Preorder Serialization of a Binary Tree105
1261Minimum Remove to Make Valid Parentheses LeetCode Solution105
1262Excel Sheet Column Title LeetCode Solution105
1263Next greater element105
1264Find k-th smallest element in BST (Order Statistics in BST)105
1265Smallest Range II Leetcode Solution104
1266Merge k Sorted Lists Leetcode Solution104
1267Print Ancestors of a Given Binary Tree Node Without Recursion104
1268Palindrome Partitioning103
1269Minimum Time to Collect All Apples in a Tree LeetCode Solution103
1270Check in binary array the number represented by a subarray is odd or even102
1271Orderly Queue LeetCode Solution102
1272Check if two nodes are on the same path in a Tree102
1273Merge Sorted Array101
1274Peeking Iterator LeetCode Solution100
1275Koko Eating Bananas LeetCode Solution100
1276Different Ways to Add Parentheses Leetcode Solution100
1277Newman–Shanks–Williams prime100
1278Number of elements less than or equal to a given number in a given subarray99
1279Check if X can give change to every person in the Queue99
1280Maximum Sum Increasing Subsequence98
1281Longest Substring Without Repeating Characters Leetcode Solution98
1282Find maximum average subarray of k length97
1283Largest Submatrix With Rearrangements LeetCode Solution97
1284Range Minimum Query (Square Root Decomposition and Sparse Table)97
1285Array Nesting Leetcode Solution96
1286Queries for Decimal Values of Subarrays of a Binary Array96
1287Number of indexes with equal elements in given range96
1288Minimum Total Space Wasted With K Resizing Operations LeetCode Solution96
1289Minimum Number of People to Teach LeetCode Solution95
1290Maximum product of an increasing subsequence95
1291Arranging Coins Leetcode Solution94
1292Check given array of size n can represent BST of n levels or not94
1293Binary Tree to Binary Search Tree Conversion using STL set94
1294Random Pick Index LeetCode Solution93
1295Minimum Possible Integer After at Most K Adjacent Swaps On Digits LeetCode Solution93
1296Jump Game IV LeetCode Solution92
1297Encoded String With Shortest Length LeetCode Solution92
1298Convert to Base -2 LeetCode Solution92
1299Convert a BST to a Binary Tree such that sum of all greater keys is added to every key92
1300Reach a Number LeetCode Solution92
1301Queries on XOR of greatest odd divisor of the range92
1302Add Two Numbers II Leetcode Solution92
1303Find the Winner of the Circular Game LeetCode Solution92
1304Insert Delete GetRandom O(1) Leetcode Solution90
1305Number of Subsequences That Satisfy the Given Sum Condition LeetCode solution89
1306Design Underground System Leetcode Solution88
1307Palindrome Number LeetCode Solution88
1308Vertical Order Traversal of Binary Tree LeetCode Solution87
1309Continuous Subarray Sum LeetCode Solution87
1310Print Maximum Length Chain of Pairs86
1311Detect Capital Leetcode Solution83
1312Design A Leaderboard Leetcode Solution82
1313Substring with Concatenation of All Words Leetcode Solution79
1314Top K Frequent Elements LeetCode Solution79
1315Minimum Swaps to Group All 1’s Together Leetcode Solution78
1316Minimum Path Sum Leetcode Solution75
1317Decode String Leetcode Solution74
1318Count Sub Islands LeetCode Solution73
1319Binary Tree Inorder Traversal LeetCode Solution72
1320Shifting Letters LeetCode Solution72
1321Odd Even Linked List Leetcode Solution72
1322Shortest Unsorted Continuous Subarray LeetCode Solution71
1323Longest Common Subsequence LeetCode Solution71
1324Maximum Population Year LeetCode Solution71
1325Best Meeting Point LeetCode Solution71
1326Sum Root to Leaf Numbers LeetCode Solution70
1327Find the Town Judge LeetCode Solution70
1328Design Add and Search Words Data Structure LeetCode Solution68
1329Find the Town Judge LeetCode Solution68
1330Rectangle Overlap LeetCode Solution66
1331Maximum Population Year LeetCode Solution66
1332Score of Parenthesis LeetCode Solution65
1333Insert into a Sorted Circular Linked List LeetCode Solution63
1334Stone Game IV LeetCode Solution62
1335Flatten Binary Tree to Linked List LeetCode Solution62
1336Is Graph Bipartite? LeetCode Solution60
1337Range Sum Query 2D – Immutable LeetCode Solution60
1338Valid Triangle Number LeetCode Solution59
1339Reveal Cards In Increasing Order Leetcode Solution55
1340Divide Chocolate LeetCode Solution51
1341Range Sum of BST LeetCode Solution44
1342Step-By-Step Directions From a Binary Tree Node to Another LeetCode Solution42
1343Reverse Integer Leetcode Solution41
1344Sort Colors LeetCode Solution38
1345Find K Closest Elements LeetCode Solution36
1346Excel Sheet Column Number LeetCode Solution34
1347Rotate String LeetCode Solution33
1348Maximum Side Length of a Square with Sum Less than or Equal to Threshold LeetCode Solution31
Translate »