Challenges
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
Results: 180
ID
Sort by Ascending order
Sort by Descending order
Search by "id:text"
Platform
Sort by Ascending order
Sort by Descending order
Search by "platform:text"
Title
Sort by Ascending order
Sort by Descending order
Search by "title:text"
Technology
Sort by Ascending order
Sort by Descending order
Search by "technology:text"
Difficulty
Sort by Ascending order
Sort by Descending order
Search by "difficulty:text"
Description
Sort by Ascending order
Sort by Descending order
Search by "description:text"
Official Solutions
Sort by Ascending order
Sort by Descending order
Search by "solution_urls:text"
YT
Sort by Ascending order
Sort by Descending order
Search by "youtube_link:text"
64 leetcode.com Reshape the Matrix Problem Solving Easy In MATLAB, there is a handy function called reshape which can reshape an m x n matrix into a new one with a different size r x c keeping its original data. You are given an m x n matrix mat and two integers r and c representing the number of rows and the number of columns of the wanted reshaped matrix. The reshaped matrix should be filled with all the elements of the original matrix in the same row-traversing order as they were. If the reshape operation with given parameters is possible and legal, output the new reshaped matrix; Otherwise, output the original matrix.   Example 1: Input: mat = [[1,2],[3,4]], r = 1, c = 4 Output: [[1,2,3,4]] Example 2: Input: mat = [[1,2],[3,4]], r = 2, c = 4 Output: [[1,2],[3,4]]
63 leetcode.com Student Attendance Record I Problem Solving Easy You are given a string s representing an attendance record for a student where each character signifies whether the student was absent, late, or present on that day. The record only contains the following three characters: 'A': Absent. 'L': Late. 'P': Present. The student is eligible for an attendance award if they meet both of the following criteria: The student was absent ('A') for strictly fewer than 2 days total. The student was never late ('L') for 3 or more consecutive days. Return true if the student is eligible for an attendance award, or false otherwise.   Example 1: Input: s = "PPALLP" Output: true Explanation: The student has fewer than 2 absences and was never late 3 or more consecutive days. Example 2: Input: s = "PPALLL" Output: false Explanation: The student was late 3 consecutive days in the last 3 days, so is not eligible for the award.
62 leetcode.com Longest Harmonious Subsequence Problem Solving Medium We define a harmonious array as an array where the difference between its maximum value and its minimum value is exactly 1. Given an integer array nums, return the length of its longest harmonious subsequence among all its possible subsequences. A subsequence of array is a sequence that can be derived from the array by deleting some or no elements without changing the order of the remaining elements.   Example 1: Input: nums = [1,3,2,2,5,2,3,7] Output: 5 Explanation: The longest harmonious subsequence is [3,2,2,2,3]. Example 2: Input: nums = [1,2,3,4] Output: 2 Example 3: Input: nums = [1,1,1,1] Output: 0
59 leetcode.com Detect Capital Problem Solving Easy We define the usage of capitals in a word to be right when one of the following cases holds: All letters in this word are capitals, like "USA". All letters in this word are not capitals, like "leetcode". Only the first letter in this word is capital, like "Google". Given a string word, return true if the usage of capitals in it is right.   Example 1: Input: word = "USA" Output: true Example 2: Input: word = "FlaG" Output: false
58 leetcode.com Relative Ranks Problem Solving Easy You are given an integer array score of size n, where score[i] is the score of the ith athlete in a competition. All the scores are guaranteed to be unique. The athletes are placed based on their scores, where the 1st place athlete has the highest score, the 2nd place athlete has the 2nd highest score, and so on. The placement of each athlete determines their rank: The 1st place athlete's rank is "Gold Medal". The 2nd place athlete's rank is "Silver Medal". The 3rd place athlete's rank is "Bronze Medal". For the 4th place to the nth place athlete, their rank is their placement number (i.e., the xth place athlete's rank is "x"). Return an array answer of size n where answer[i] is the rank of the ith athlete.   Example 1: Input: score = [5,4,3,2,1] Output: ["Gold Medal","Silver Medal","Bronze Medal","4","5"] Explanation: The placements are [1st, 2nd, 3rd, 4th, 5th]. Example 2: Input: score = [10,3,8,9,4] Output: ["Gold Medal","5","Bronze Medal","Silver Medal","4"] Explanation: The placements are [1st, 5th, 3rd, 2nd, 4th].
57 leetcode.com Keyboard Row Problem Solving Medium Given an array of strings words, return the words that can be typed using letters of the alphabet on only one row of American keyboard like the image below. In the American keyboard: the first row consists of the characters "qwertyuiop", the second row consists of the characters "asdfghjkl", and the third row consists of the characters "zxcvbnm".   Example 1: Input: words = ["Hello","Alaska","Dad","Peace"] Output: ["Alaska","Dad"] Example 2: Input: words = ["omk"] Output: [] Example 3: Input: words = ["adsdf","sfd"] Output: ["adsdf","sfd"]
56 leetcode.com Construct the Rectangle Problem Solving Easy A web developer needs to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose length L and width W satisfy the following requirements: The area of the rectangular web page you designed must equal to the given target area. The width W should not be larger than the length L, which means L >= W. The difference between length L and width W should be as small as possible. Return an array [L, W] where L and W are the length and width of the web page you designed in sequence.   Example 1: Input: area = 4 Output: [2,2] Explanation: The target area is 4, and all the possible ways to construct it are [1,4], [2,2], [4,1]. But according to requirement 2, [1,4] is illegal; according to requirement 3, [4,1] is not optimal compared to [2,2]. So the length L is 2, and the width W is 2. Example 2: Input: area = 37 Output: [37,1] Example 3: Input: area = 122122 Output: [427,286]
55 leetcode.com Max Consecutive Ones Problem Solving Easy Given a binary array nums, return the maximum number of consecutive 1's in the array.   Example 1: Input: nums = [1,1,0,1,1,1] Output: 3 Explanation: The first two digits or the last three digits are consecutive 1s. The maximum number of consecutive 1s is 3. Example 2: Input: nums = [1,0,1,1,0,1] Output: 2
53 leetcode.com Find All Numbers Disappeared in an Array Problem Solving Very easy Given an array nums of n integers where nums[i] is in the range [1, n], return an array of all the integers in the range [1, n] that do not appear in nums.   Example 1: Input: nums = [4,3,2,7,8,2,3,1] Output: [5,6] Example 2: Input: nums = [1,1] Output: [2]
52 leetcode.com Arranging Coins Problem Solving Very easy You have n coins and you want to build a staircase with these coins. The staircase consists of k rows where the ith row has exactly i coins. The last row of the staircase may be incomplete. Given the integer n, return the number of complete rows of the staircase you will build.   Example 1: Input: n = 5 Output: 2 Explanation: Because the 3rd row is incomplete, we return 2. Example 2: Input: n = 8 Output: 3 Explanation: Because the 4th row is incomplete, we return 3.
Results: 180