First Missing Positive – Leetcode Python

LeetCode has a Hard coding Problem in Its’ Algorithm Section “First Missing Positive”. Today We are going to solve this problem. LeetCode Link of the Problem is HERE Question Given an unsorted integer array nums, return the smallest missing positive integer. You must implement an algorithm that runs in O(n) time and uses constant extra space. Examples Input: … Read more

Find First And Last Position of Element in Sorted Array

LeetCode has a Medium coding Problem in Its’ Algorithm Section “Find First And Last Position of Element in Sorted Array”. Today We are going to solve this problem. LeetCode Link of the Problem is HERE Question Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value. If target is not … Read more

Search in Rotated Sorted Array – Leetcode Python

LeetCode has a Medium coding Problem in Its’ Algorithm Section “Search in Rotated Sorted Array”. Today We are going to solve this problem. LeetCode Link of the Problem is HERE Question There is an integer array nums sorted in ascending order (with distinct values). Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 <= k < … Read more

Longest Valid Parentheses – Leetcode Python

LeetCode has a Hard coding Problem in Its’ Algorithm Section “Longest Valid Parentheses”. Today We are going to solve this problem. LeetCode Link of the Problem is HERE Question Given a string containing just the characters ‘(‘ and ‘)’, find the length of the longest valid (well-formed) parentheses substring. Examples Input: s = “(()” Output: 2 Explanation: The … Read more

Next Permutation Leetcode – Python Solution

LeetCode has a Medium coding Problem in Its’ Algorithm Section “Next Permutation Leetcode”. Today We are going to solve this problem. LeetCode Link of the Problem is HERE. Question A permutation of an array of integers is an arrangement of its members into a sequence or linear order. For example, for arr = [1,2,3], the following are considered … Read more

Substring with Concatenation of All Words – LeetCode

LeetCode has a hard coding Problem in Its’ Algorithm Section “Substring with Concatenation of All Words”. Today We are going to solve this problem. LeetCode Link of the Problem is HERE Question You are given a string s and an array of strings words of the same length. Return all starting indices of substring(s) in s that is a concatenation of each word in words exactly … Read more

Divide Two integers Leetcode python

LeetCode has a Medium coding Problem in Its’ Algorithm Section “Divide Two integers Leetcode python”. Today We are going to solve this problem. LeetCode Link of the Problem is HERE Question Given two integers dividend and divisor, divide two integers without using multiplication, division, and mod operator. The integer division should truncate toward zero, which means losing its fractional part. For … Read more

Implement strStr() – Leetcode Python Solution

LeetCode has a Easy coding Problem in Its’ Algorithm Section “Implement strStr()”. Today We are going to solve this problem. LeetCode Link of the Problem is HERE Question Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Clarification: What should we return when needle is an empty string? This is … Read more

Remove nth node from end of list Leetcode Python

LeetCode has a Medium coding Problem in Its’ Algorithm Section “remove nth node from end of list leetcode python”. Today We are going to solve this problem. LeetCode Link of the Problem is HERE Question Given the head of a linked list, remove the nth node from the end of the list and return its head. Example 1: Examples Input: … Read more

4sum Problem Leetcode – Python Solutions

LeetCode has a Medium coding Problem in Its’ Algorithm Section “4sum problem Leetcode”. Today We are going to solve this problem. LeetCode Link of the Problem is HERE Question Given an array nums of n integers, return an array of all the unique quadruplets [nums[a], nums[b], nums[c], nums[d]] such that: 0 <= a, b, c, d < n a, b, c, and d are distinct. nums[a] + nums[b] + nums[c] + … Read more