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 — Trapping Rain Water

Posted on February 2, 2024February 10, 2024 By allexamprep.com No Comments on LeetCode Hard — Trapping Rain Water

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining. Example 1: Input: height = [0,1,0,2,1,0,1,3,2,1,2,1] Output: 6 Explanation: The above elevation map (black section) is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of rain water (blue section) are being trapped….

Read More “LeetCode Hard — Trapping Rain Water” »

LEETCode

LeetCode Hard – First Missing Positive

Posted on February 2, 2024February 10, 2024 By allexamprep.com No Comments on LeetCode Hard – First Missing Positive

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 O(1) auxiliary space. Example 1:Input: nums = [1,2,0] Output: 3 Explanation: The numbers in the range [1,2] are all in the array. Example 2:Input: nums = [3,4,-1,1] Output: 2 Explanation: 1 is in the array but…

Read More “LeetCode Hard – First Missing Positive” »

LEETCode

LeetCode Hard – Sudoku Solver

Posted on February 2, 2024February 10, 2024 By allexamprep.com No Comments on LeetCode Hard – Sudoku Solver

Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all of the following rules: The ‘.’ character indicates empty cells. Example 1: Input: board = [[“5″,”3″,”.”,”.”,”7″,”.”,”.”,”.”,”.”],[“6″,”.”,”.”,”1″,”9″,”5″,”.”,”.”,”.”],[“.”,”9″,”8″,”.”,”.”,”.”,”.”,”6″,”.”],[“8″,”.”,”.”,”.”,”6″,”.”,”.”,”.”,”3″],[“4″,”.”,”.”,”8″,”.”,”3″,”.”,”.”,”1″],[“7″,”.”,”.”,”.”,”2″,”.”,”.”,”.”,”6″],[“.”,”6″,”.”,”.”,”.”,”.”,”2″,”8″,”.”],[“.”,”.”,”.”,”4″,”1″,”9″,”.”,”.”,”5″],[“.”,”.”,”.”,”.”,”8″,”.”,”.”,”7″,”9″]] Output: [[“5″,”3″,”4″,”6″,”7″,”8″,”9″,”1″,”2”],[“6″,”7″,”2″,”1″,”9″,”5″,”3″,”4″,”8”],[“1″,”9″,”8″,”3″,”4″,”2″,”5″,”6″,”7”],[“8″,”5″,”9″,”7″,”6″,”1″,”4″,”2″,”3”],[“4″,”2″,”6″,”8″,”5″,”3″,”7″,”9″,”1”],[“7″,”1″,”3″,”9″,”2″,”4″,”8″,”5″,”6”],[“9″,”6″,”1″,”5″,”3″,”7″,”2″,”8″,”4”],[“2″,”8″,”7″,”4″,”1″,”9″,”6″,”3″,”5”],[“3″,”4″,”5″,”2″,”8″,”6″,”1″,”7″,”9”]] Explanation: The input board is shown above and the only valid solution is shown below: Constraints: Java Solution This program defines a…

Read More “LeetCode Hard – Sudoku Solver” »

LEETCode

LeetCode Problem – Longest Valid Parentheses

Posted on February 2, 2024February 10, 2024 By allexamprep.com No Comments on LeetCode Problem – Longest Valid Parentheses

Given a string containing just the characters ‘(‘ and ‘)’, return the length of the longest valid (well-formed) parentheses  substring. Example 1:Input: s = “(()” Output: 2 Explanation: The longest valid parentheses substring is “()”. Example 2:Input: s = “)()())” Output: 4 Explanation: The longest valid parentheses substring is “()()”. Example 3:Input: s = “” Output: 0 Constraints: Java…

Read More “LeetCode Problem – Longest Valid Parentheses” »

LEETCode

LeetCode Problem – Substring with Concatenation of All Words

Posted on February 2, 2024February 10, 2024 By allexamprep.com No Comments on LeetCode Problem – Substring with Concatenation of All Words

You are given a string s and an array of strings words. All the strings of words are of the same length. A concatenated substring in s is a substring that contains all the strings of any permutation of words concatenated. Return the starting indices of all the concatenated substrings in s. You can return the answer in any order. Example 1:Input: s = “barfoothefoobarman”, words = [“foo”,”bar”] Output: [0,9]…

Read More “LeetCode Problem – Substring with Concatenation of All Words” »

LEETCode

LeetCode Problem – Reverse Nodes in k-Group

Posted on February 2, 2024February 10, 2024 By allexamprep.com No Comments on LeetCode Problem – Reverse Nodes in k-Group

Given the head of a linked list, reverse the nodes of the list k at a time, and return the modified list. k is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of k then left-out nodes, in the end, should remain as it is. You…

Read More “LeetCode Problem – Reverse Nodes in k-Group” »

LEETCode

LeetCode Problem – Merge k Sorted Lists

Posted on January 31, 2024February 10, 2024 By allexamprep.com No Comments on LeetCode Problem – Merge k Sorted Lists

Problem Statement You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list and return it. Example 1: Input: lists = [[1,4,5],[1,3,4],[2,6]] Output: [1,1,2,3,4,4,5,6] Explanation: The linked-lists are: [ 1->4->5, 1->3->4, 2->6 ] merging them into one sorted list: 1->1->2->3->4->4->5->6 Example 2:…

Read More “LeetCode Problem – Merge k Sorted Lists” »

LEETCode

LeetCode Problem – Regular Expression Matching

Posted on January 31, 2024February 10, 2024 By allexamprep.com No Comments on LeetCode Problem – Regular Expression Matching

Problem Statement Given an input string s and a pattern p, implement regular expression matching with support for ‘.’ and ‘*’ where: ‘.’ Matches any single character.​​​​ ‘*’ Matches zero or more of the preceding element. The matching should cover the entire input string (not partial). Example 1: Input: s = “aa”, p = “a”…

Read More “LeetCode Problem – Regular Expression Matching” »

LEETCode

LeetCode Problem – Median of sorted array

Posted on January 31, 2024February 10, 2024 By allexamprep.com No Comments on LeetCode Problem – Median of sorted array

Problem Statement Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: Input: nums1 = [1,3], nums2 = [2] Output: 2.00000 Explanation: merged array = [1,2,3] and median is 2. Example 2: Input:…

Read More “LeetCode Problem – Median of sorted array” »

LEETCode

LeetCode Problem – Temperature Prediction

Posted on January 31, 2024February 10, 2024 By allexamprep.com No Comments on LeetCode Problem – Temperature Prediction

Problem Statement Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the ith day to get a warmer temperature. If there is no future day for which this is possible, keep answer[i] == 0 instead. Example 1:…

Read More “LeetCode Problem – Temperature Prediction” »

LEETCode

Posts pagination

Previous 1 2 3

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