In an array A containing only 0s and 1s, a K-bit flip consists of choosing a (contiguous) subarray of length K…
分类:LeetCode
165. Compare Version Numbers
Compare two version numbers version1 and version2.If version1 > version2 return 1; if version1 < version…
[array] leetcode - 39. Combination Sum - Medium
leetcode – 39. Combination Sum – Medium descrition Given a set of candidate numbers (C) (without d…
【Leetcode】491. Increasing Subsequences
Question 491. Increasing Subsequences Given an integer array, your task is to find all the different possible …
339. Nested List Weight Sum
Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Each elem…
86. 分隔链表
86. 分隔链表 问题 给定一个链表和一个特定值 ,对链表进行分隔,使得所有小于 的节点都在大于或等于的节点之前。 你应当保留两个分区中每个节点的初始相对位置。 示例: 输入: 输出: 解法 新建两个,其中一个保存所有小…
[LeetCode] Best Time to Buy and Sell Stock 买卖股票的最佳时间
Say you have an array for which the ith element is the price of a given stock on day i. …
[LEetCode][Python]459. Repeated Substring Pattern
Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple cop…
[LeetCode] Verify Preorder Serialization of a Binary Tree 验证二叉树的先序序列化
One way to serialize a binary tree is to use pre-oder traversal. When we encounter a non-null node, we …
[LeetCode] Reverse String 翻转字符串
Write a function that takes a string as input and returns the string reversed. Example: Given s = ̶…
[LeetCode] Base 7 基数七
Given an integer, return its base 7 string representation. Example 1: Input: 100 Output: "202" E…
[LeetCode] Bold Words in String 字符串中的加粗单词
Given a set of keywords words and a string S, make all appearances of all keywords in&nb…