全站内容
Calf
这里收录 Calf 在 GoCalf 上的文章、笔记与其他内容。
1368. Minimum Cost to Make at Least One Valid Path in a Grid
#Problem Given an m x n grid. Each cell of the grid has a sign pointing to the next cell you should visit if you are currently in this cell. The sign of grid[i][j] can be: 1 which means go to the cell to the right. (i.e go from grid[i][j] …
1374. Generate a String With Characters That Have Odd Counts
#Problem Given an integer n, return a string with n characters such that each character in such string occurs an odd number of times. The returned string must contain only lowercase English letters. If there are multiples valid strings, …
1387. Sort Integers by The Power Value
#Problem The power of an integer x is defined as the number of steps needed to transform x into 1 using the following steps: if x is even then x = x / 2 if x is odd then x = 3 * x + 1 For example, the power of x = 3 is 7 because 3 needs 7 …
139. Word Break
#Problem Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words. Note that the same word in the dictionary may be reused multiple times in the …
1400. Construct K Palindrome Strings
#Problem Given a string s and an integer k, return true if you can use all the characters in s to construct k palindrome strings or false otherwise. https://leetcode.com/problems/construct-k-palindrome-strings/ Example 1: Input: s = …
1408. String Matching in an Array
#Problem Given an array of string words, return all strings in words that is a substring of another word. You can return the answer in any order. A substring is a contiguous sequence of characters within a string. …
141. Linked List Cycle
#Problem Given head, the head of a linked list, determine if the linked list has a cycle in it. There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the next pointer. …
1415. The k-th Lexicographical String of All Happy Strings of Length n
#Problem A happy string is a string that: consists only of letters of the set ['a', 'b', 'c']. s[i] != s[i + 1] for all values of i from 1 to s.length - 1 (string is 1-indexed). For example, strings “abc”, “ac”, “b” and “abcbabcbcb” are all …
1422. Maximum Score After Splitting a String
#Problem Given a string s of zeros and ones, return the maximum score after splitting the string into two non-empty substrings (i.e. left substring and right substring). The score after splitting a string is the number of zeros in the left …
143. Reorder List
#Problem You are given the head of a singly linked-list. The list can be represented as: L0 → L1 → … → Ln - 1 → Ln Reorder the list to be on the following form: L0 → Ln → L1 → Ln - 1 → L2 → Ln - 2 → … You may not modify the values in the …