3Sum Closest LeetCode Solution

Problem Statement 3Sum Closest LeetCode Solution – Given an integer array nums of length n and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would have exactly one solution. Input: nums = [-1,2,1,-4], target = 1 Output: …

Read more

Largest Number Leetcode Solution

Problem Statement The Largest Number LeetCode Solution – “Largest Number” states that given a list of non-negative integers nums, we need to arrange the numbers in such a way that they form the largest number and return it. Since the result may be very large, so you need to return …

Read more

Maximum Length of a Concatenated String with Unique Characters Leetcode Solution

Problem Statement The Maximum Length of a Concatenated String with Unique Characters LeetCode Solution – “Maximum Length of a Concatenated String with Unique Characters” says that you’re given an array of strings and you need to choose any subsequence of the given array and concatenate those strings to form the …

Read more

Subarray Sum Equals K LeetCode Solution

Problem Statement The Subarray Sum Equals K LeetCode Solution – “Subarray Sum Equals K” states that you are given an array of integers “nums” and an integer ‘k’, return the total number of continuous subarrays whose sum equals to ‘k’. Example: nums = [1, 2, 3], k=3 2 Explanation: There …

Read more

Longest Palindromic Substring LeetCode Solution

Problem Statement The Longest Palindromic Substring LeetCode Solution – “Longest Palindromic Substring” states that You are Given a string s, return the longest palindromic substring in s. Note: A palindrome is a word that reads the same backward as forwards, e.g. madam. Example:   s = “babad” “bab” Explanation: All …

Read more

3Sum Leetcode Solution

Problem Statement Given an array of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Notice: that the solution set must not contain duplicate triplets. Example #1 [-1,0,1,2,-1,4] …

Read more

Maximum Number of Balloons Leetcode Solution

Problem Statement In this problem, we are given a string of characters containing lower-case English letters. We need to find how many instances of the word “balloon” can we make using the characters of the given string. Example String = “banooll” 1 Explanation: String = baqwweeeertylln 0 Explanation: As the …

Read more

Search in Rotated Sorted Array Leetcode Solution

Consider a sorted array but one index was picked and the array was rotated at that point. Now, once the array has been rotated you are required to find a particular target element and return its index. In case, the element is not present, return -1. The problem is generally …

Read more

Translate »