[LeetCode] 1328. Break a Palindrome Given a palindromic string of lowercase English letters palindrome, replace exactly one character with any lowercase English letter so that the resulting string is not a palindrome and that it is the 2022-10-11 #leetcode #java #greedy #string
[LeetCode] 2007. Find Original Array From Doubled Array An integer array original is transformed into a doubled array changed by appending twice the value of every element in original, and then randomly shuffling the resulting array. Given an array changed 2022-09-18 #leetcode #java #array #hashmap #greedy #sort
[LeetCode] 1608. Special Array With X Elements Greater Than or Equal X You are given an array nums of non-negative integers. nums is considered special if there exists a number x such that there are exactly x numbers in nums that are greater than or equal to x. Notice th 2022-09-12 #leetcode #java #array #counting sort #sort #binary search #binary search on answer
[LeetCode] 1184. Distance Between Bus Stops A bus has n stops numbered from 0 to n - 1 that form a circle. We know the distance between all pairs of neighboring stops where distance[i] is the distance between the stops number i and (i + 1) % n. 2022-07-24 #leetcode #java #array
[LeetCode] 828. Count Unique Characters of All Substrings of a Given String Let’s define a function countUniqueChars(s) that returns the number of unique characters in s. For example, calling countUniqueChars(s) if s = “LEETCODE” then “L”, “T”, “C”, “O”, “D” are the uniq 2022-07-12 #leetcode #java #hashmap #string
[LeetCode] 729. My Calendar I You are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a double booking. A double booking happens when two events have some non-empty interse 2022-07-05 #leetcode #java #treemap #design
[LeetCode] 2116. Check if a Parentheses String Can Be Valid A parentheses string is a non-empty string consisting only of ‘(‘ and ‘)’. It is valid if any of the following conditions is true:It is ().It can be written as AB (A concatenated with B), where A and 2022-07-02 #leetcode #java #greedy #string #stack
[LeetCode] 475. Heaters Winter is coming! During the contest, your first job is to design a standard heater with a fixed warm radius to warm all the houses. Every house can be warmed, as long as the house is within the heate 2022-06-09 #leetcode #java #array #two pointer #sort #binary search #binary search on answer
[LeetCode] 1491. Average Salary Excluding the Minimum and Maximum Salary You are given an array of unique integers salary where salary[i] is the salary of the ith employee. Return the average salary of employees excluding the minimum and maximum salary. Answers within 10-5 2022-02-07 #leetcode #java #array #math
[LeetCode] 2000. Reverse Prefix of Word Given a 0-indexed string word and a character ch, reverse the segment of word that starts at index 0 and ends at the index of the first occurrence of ch (inclusive). If the character ch does not exist 2022-02-06 #leetcode #java #two pointer #string