代码改变世界

[LeetCode] 857. Minimum Cost to Hire K Workers_Hard tag: sort, heap

2021-08-16 10:12 by Johnson_强生仔仔, 31 阅读, 0 推荐, 收藏, 编辑
摘要:There are n workers. You are given two integer arrays quality and wage where quality[i] is the quality of the ith worker and wage[i] is the minimum wa 阅读全文

[LeetCode] 849. Maximize Distance to Closest Person_Medium tag: BFS, array

2021-08-12 07:45 by Johnson_强生仔仔, 18 阅读, 0 推荐, 收藏, 编辑
摘要:You are given an array representing a row of seats where seats[i] = 1 represents a person sitting in the ith seat, and seats[i] = 0 represents that th 阅读全文

[LeetCode] 833. Find And Replace in String_Medium tag: array

2021-08-12 01:47 by Johnson_强生仔仔, 32 阅读, 0 推荐, 收藏, 编辑
摘要:Y ou are given a 0-indexed string s that you must perform k replacement operations on. The replacement operations are given as three 0-indexed paralle 阅读全文

[LeetCode] 809. Expressive Words_Medium tag: array, two pointers

2021-08-12 01:16 by Johnson_强生仔仔, 28 阅读, 0 推荐, 收藏, 编辑
摘要:Sometimes people repeat letters to represent extra feeling. For example: "hello" -> "heeellooo" "hi" -> "hiiii" In these strings like "heeellooo", we 阅读全文

[LeetCode] 681. Next Closest Time_Medium tag: array, sort

2021-08-10 10:46 by Johnson_强生仔仔, 26 阅读, 0 推荐, 收藏, 编辑
摘要:Given a time represented in the format "HH:MM", form the next closest time by reusing the current digits. There is no limit on how many times a digit 阅读全文

[LeetCode] 163. Missing Ranges_Easy tag: array

2021-08-10 09:54 by Johnson_强生仔仔, 26 阅读, 0 推荐, 收藏, 编辑
摘要:You are given an inclusive range [lower, upper] and a sorted unique integer array nums, where all elements are in the inclusive range. A number x is c 阅读全文

[LeetCode] 159. Longest Substring with At Most Two Distinct Characters_Medium tag: Two pointers

2021-08-10 09:21 by Johnson_强生仔仔, 31 阅读, 0 推荐, 收藏, 编辑
摘要:Given a string s, return the length of the longest substring that contains at most two distinct characters. Example 1: Input: s = "eceba" Output: 3 Ex 阅读全文

[LeetCode] 158. Read N Characters Given Read4 II - Call multiple times_Hard tag: array, queue

2021-08-09 11:23 by Johnson_强生仔仔, 36 阅读, 0 推荐, 收藏, 编辑
摘要:Given a file and assume that you can only read the file using a given method read4, implement a method read to read n characters. Your method read may 阅读全文

[LeetCode] 157. Read N Characters Given Read4_Easy tag: array

2021-08-09 10:35 by Johnson_强生仔仔, 21 阅读, 0 推荐, 收藏, 编辑
摘要:Given a file and assume that you can only read the file using a given method read4, implement a method to read n characters. Method read4: The API rea 阅读全文

[LeetCode] 76. Minimum Window Substring_Hard tag: two pointers

2021-08-08 09:27 by Johnson_强生仔仔, 26 阅读, 0 推荐, 收藏, 编辑
摘要:Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicat 阅读全文
上一页 1 2 3 4 5 6 7 ··· 39 下一页