ProDeveloperTutorialonDecember 26, 2024 Given an unsorted linked list, sort the list using merge sort. Example: 3 -> 4 -> 5-> 1 -> 2 Output: 1 -> 2 -> 3 -> 4 -> 5 Merge sort is a divide and conquer algorithm. Here we…
ProDeveloperTutorialonDecember 26, 2024 Sort a linked list using insertion sort. Sort a linked list using insertion sort. Example 1: Input: 4->2->1->3 Output: 1->2->3->4 Example 2: Input:…
ProDeveloperTutorialonDecember 26, 2024 Reorder list in to alternate nodes like first lowest and first highest. Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You may not modify the values in the list’s nodes,…
ProDeveloperTutorialonDecember 26, 2024 Given a sentence and maxWidth. Arrange the text in such a way that each line has exactly maxWidth characters and is fully justified. Your answer should be of greedy approach. You should pack as many words you can in each line. If you cannot fit the whole word, then fill the…
ProDeveloperTutorialonDecember 26, 2024 Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? Solution Explanation: Take an extra pointer “fast” and assign its starting point to…
ProDeveloperTutorialonDecember 26, 2024 Given a non-empty array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? Example 1: Input: [2,2,1]…
ProDeveloperTutorialonDecember 25, 2024 Soduku Solver Before solving this problem, it is recommended that you go through “valid sudoku” problem. Check if the given board is valid Sudoku or not…
ProDeveloperTutorialonDecember 25, 2024 Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. Example: Input: "aab" Output: [ ["aa","b"],…
ProDeveloperTutorialonDecember 25, 2024 Woord Ladder You are given 2 words beginWord and endWord. You need to return the number of words, that will transform from beginWord to endWord beginWord =…
ProDeveloperTutorialonDecember 25, 2024 Best time to buy sell stock You are given an array with the price of the stock on the ith day. You need to max the profit by choosing a day to buy and choosing different…