Machine Learning Projects [Solved] Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence. You must write an algorithm that runs in O(n) time.Leetcode SolutionsAbhishek SharmaSeptember 12, 2022[Solved] You are given the root of a binary tree containing digits from 0 to 9 only. Each root-to-leaf path in the tree represents a number. For example, the root-to-leaf path 1 -> 2 -> 3 represents the number 123. Return the total sum of all root-to-leaf numbers. Test cases are generated so that the answer will fit in a 32-bit integer.Leetcode SolutionsAbhishek SharmaSeptember 12, 2022[Solved] Given a non-empty array of integers nums, every element appears twice except for one. Find that single one. You must implement a solution with a linear runtime complexity and use only constant extra space.Leetcode SolutionsAbhishek SharmaSeptember 12, 2022[Solved] A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence at most once. Note that the path does not need to pass through the root. The path sum of a path is the sum of the node’s values in the path. Given the root of a binary tree, return the maximum path sum of any non-empty path.Leetcode SolutionsAbhishek SharmaSeptember 12, 2022[Solved] You are given an integer array prices where prices[i] is the price of a given stock on the ith day. On each day, you may decide to buy and/or sell the stock. You can only hold at most one share of the stock at any time. However, you can buy it then immediately sell it on the same day. Find and return the maximum profit you can achieve.Leetcode SolutionsAbhishek SharmaSeptember 12, 2022[Solved] You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock. Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.Leetcode SolutionsAbhishek SharmaSeptember 12, 2022[Solved] Given an integer rowIndex, return the rowIndexth (0-indexed) row of the Pascal’s triangle. In Pascal’s triangle, each number is the sum of the two numbers directly above it as shown:Leetcode SolutionsAbhishek SharmaSeptember 12, 2022[Solved] Given an integer numRows, return the first numRows of Pascal’s triangle. In Pascal’s triangle, each number is the sum of the two numbers directly above it as shown.Leetcode SolutionsAbhishek SharmaSeptember 12, 2022[Solved] You are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following definition:Leetcode SolutionsAbhishek SharmaSeptember 12, 2022[Solved] Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals targetSum. A leaf is a node with no children.Leetcode SolutionsAbhishek SharmaSeptember 9, 2022 Prev1 … 31 32 33 34 35 36 37 … 52Next
[Solved] Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence. You must write an algorithm that runs in O(n) time.Leetcode SolutionsAbhishek SharmaSeptember 12, 2022
[Solved] You are given the root of a binary tree containing digits from 0 to 9 only. Each root-to-leaf path in the tree represents a number. For example, the root-to-leaf path 1 -> 2 -> 3 represents the number 123. Return the total sum of all root-to-leaf numbers. Test cases are generated so that the answer will fit in a 32-bit integer.Leetcode SolutionsAbhishek SharmaSeptember 12, 2022
[Solved] Given a non-empty array of integers nums, every element appears twice except for one. Find that single one. You must implement a solution with a linear runtime complexity and use only constant extra space.Leetcode SolutionsAbhishek SharmaSeptember 12, 2022
[Solved] A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence at most once. Note that the path does not need to pass through the root. The path sum of a path is the sum of the node’s values in the path. Given the root of a binary tree, return the maximum path sum of any non-empty path.Leetcode SolutionsAbhishek SharmaSeptember 12, 2022
[Solved] You are given an integer array prices where prices[i] is the price of a given stock on the ith day. On each day, you may decide to buy and/or sell the stock. You can only hold at most one share of the stock at any time. However, you can buy it then immediately sell it on the same day. Find and return the maximum profit you can achieve.Leetcode SolutionsAbhishek SharmaSeptember 12, 2022
[Solved] You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock. Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.Leetcode SolutionsAbhishek SharmaSeptember 12, 2022
[Solved] Given an integer rowIndex, return the rowIndexth (0-indexed) row of the Pascal’s triangle. In Pascal’s triangle, each number is the sum of the two numbers directly above it as shown:Leetcode SolutionsAbhishek SharmaSeptember 12, 2022
[Solved] Given an integer numRows, return the first numRows of Pascal’s triangle. In Pascal’s triangle, each number is the sum of the two numbers directly above it as shown.Leetcode SolutionsAbhishek SharmaSeptember 12, 2022
[Solved] You are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following definition:Leetcode SolutionsAbhishek SharmaSeptember 12, 2022
[Solved] Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals targetSum. A leaf is a node with no children.Leetcode SolutionsAbhishek SharmaSeptember 9, 2022