Skip to content

  • Home
    • Featured Questions
    • Latest Updates
  • Subjects
    • Mathematics
    • Science
    • Computers
    • English
    • General Knowledge
    • History
  • Tips & Strategies
    • Test taking strategy
    • Stress Management
    • Time Management
  • Tools & Utilities
    • Generate Speech From Text
    • Change Your Voice
    • Generate Image From Text
    • Compress Your Images
  • Contact
    • Privacy Policy
    • Mission & Vision
  • Toggle search form

Tag: LeetCode Hard

LeetCode Hard – Find Minimum in Rotated Sorted Array II

Posted on February 10, 2024 By allexamprep.com No Comments on LeetCode Hard – Find Minimum in Rotated Sorted Array II

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,4,4,5,6,7] might become: Notice that rotating an array [a[0], a[1], a[2], …, a[n-1]] 1 time results in the array [a[n-1], a[0], a[1], a[2], …, a[n-2]]. Given the sorted rotated array nums that may contain duplicates, return the minimum element of this array. You must decrease the overall operation steps as much…

Read More “LeetCode Hard – Find Minimum in Rotated Sorted Array II” »

LEETCode

LeetCode Hard – Max Points on a Line

Posted on February 10, 2024 By allexamprep.com No Comments on LeetCode Hard – Max Points on a Line

Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane, return the maximum number of points that lie on the same straight line. Example 1: Input: points = [[1,1],[2,2],[3,3]] Output: 3 Example 2: Input: points = [[1,1],[3,2],[5,3],[4,1],[2,3],[1,4]] Output: 4 Constraints: Java Solution To solve this problem, you can iterate through each pair of points and…

Read More “LeetCode Hard – Max Points on a Line” »

LEETCode

LeetCode Hard – Word Break II

Posted on February 10, 2024February 10, 2024 By allexamprep.com No Comments on LeetCode Hard – Word Break II

Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in any order. Note that the same word in the dictionary may be reused multiple times in the segmentation. Example 1: Input: s = “catsanddog”, wordDict = [“cat”,”cats”,”and”,”sand”,”dog”] Output: [“cats and…

Read More “LeetCode Hard – Word Break II” »

LEETCode

LeetCode Hard –  Candy

Posted on February 10, 2024 By allexamprep.com No Comments on LeetCode Hard –  Candy

There are n children standing in a line. Each child is assigned a rating value given in the integer array ratings. You are giving candies to these children subjected to the following requirements: Return the minimum number of candies you need to have to distribute the candies to the children. Example 1: Input: ratings = [1,0,2] Output: 5 Explanation:…

Read More “LeetCode Hard –  Candy” »

LEETCode

LeetCode Hard – Palindrome Partitioning II

Posted on February 10, 2024February 10, 2024 By allexamprep.com No Comments on LeetCode Hard – Palindrome Partitioning II

Given a string s, partition s such that every  substring of the partition is a  palindrome. Return the minimum cuts needed for a palindrome partitioning of s. Example 1: Input: s = “aab” Output: 1 Explanation: The palindrome partitioning [“aa”,”b”] could be produced using 1 cut. Example 2: Input: s = “a” Output: 0 Example 3: Input: s = “ab” Output: 1 Constraints:…

Read More “LeetCode Hard – Palindrome Partitioning II” »

LEETCode

LeetCode Hard – Word Ladder

Posted on February 10, 2024February 10, 2024 By allexamprep.com No Comments on LeetCode Hard – Word Ladder

A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> … -> sk such that: Given two words, beginWord and endWord, and a dictionary wordList, return the number of words in the shortest transformation sequence from beginWord to endWord, or 0 if no such sequence exists. Example 1: Input: beginWord = “hit”, endWord = “cog”, wordList = [“hot”,”dot”,”dog”,”lot”,”log”,”cog”] Output: 5 Explanation: One shortest transformation sequence…

Read More “LeetCode Hard – Word Ladder” »

LEETCode

LeetCode Hard – Word Ladder II

Posted on February 10, 2024 By allexamprep.com No Comments on LeetCode Hard – Word Ladder II

A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> … -> sk such that: Given two words, beginWord and endWord, and a dictionary wordList, return all the shortest transformation sequences from beginWord to endWord, or an empty list if no such sequence exists. Each sequence should be returned as a list of the words [beginWord, s1, s2, …, sk]. Example 1:…

Read More “LeetCode Hard – Word Ladder II” »

LEETCode

LeetCode Hard – Binary Tree Maximum Path Sum

Posted on February 10, 2024February 10, 2024 By allexamprep.com No Comments on LeetCode Hard – Binary Tree Maximum Path Sum

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…

Read More “LeetCode Hard – Binary Tree Maximum Path Sum” »

LEETCode

LeetCode Hard – Best Time to Buy and Sell Stock III

Posted on February 10, 2024 By allexamprep.com No Comments on LeetCode Hard – Best Time to Buy and Sell Stock III

You are given an array prices where prices[i] is the price of a given stock on the ith day. Find the maximum profit you can achieve. You may complete at most two transactions. Note: You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again). Example 1: Input: prices = [3,3,5,0,0,3,1,4] Output: 6 Explanation: Buy on…

Read More “LeetCode Hard – Best Time to Buy and Sell Stock III” »

LEETCode

LeetCode Hard – Distinct Subsequences

Posted on February 10, 2024February 10, 2024 By allexamprep.com No Comments on LeetCode Hard – Distinct Subsequences

Given two strings s and t, return the number of distinct subsequences of s which equals t. The test cases are generated so that the answer fits on a 32-bit signed integer. Example 1: Input: s = “rabbbit”, t = “rabbit” Output: 3 Explanation: As shown below, there are 3 ways you can generate “rabbit” from s. rabbbitrabbbitrabbbit Example 2: Input:…

Read More “LeetCode Hard – Distinct Subsequences” »

LEETCode

Posts pagination

1 2 3 Next

Recent Posts

  • Seminar Topic: “Adversarial Machine Learning: Challenges, Defense Mechanisms, and Real-World Implications”
  • Title: Exploring Explainable Artificial Intelligence (XAI) in Deep Learning
  • Project: Simple Weather App with OpenWeatherMap API
  • Project: Web Scraping Quotes with BeautifulSoup
  • Project: Automated Document Summarization with Gensim

Recent Comments

  1. Mystic Knightt on How to get generated id in spring batch template insert
  2. Sachin on How to get generated id in spring batch template insert

Archives

  • February 2024
  • January 2024

Categories

  • Biology
  • Blog
  • Computer QnA
  • LEETCode
  • Projects
  • Privacy Policy
  • Terms Of Service
  • Contact
  • About Us

Copyright © 2025 .

AllExamPrep