Implement a data structure supporting the following operations: Inc(Key) – Inserts a new k…
分类:LeetCode
[LeetCode] Magical String 神奇字符串
A magical string S consists of only ‘1’ and ‘2’ and obeys the followi…
[LeetCode] Split Array with Equal Sum 分割数组成和相同的子数组
Given an array with n integers, you need to find if there are triplets (i, j, k) which satisfies follow…
LeetCode 229 Majority Element II
题目描述 Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm sh…
[Leetcode] Combination Sum 组合数之和
Combination Sum I Given a set of candidate numbers (C) and a target number (T), find all unique combinations i…
LeetCode 25. Reverse Nodes in k-Group
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a posit…
力扣(LeetCode)-134 加油站
本题考察的是最大子序列和 题目描述 在一条环路上有 N 个加油站,其中第 i 个加油站有汽油 gas[i] 升。 你有一辆油箱容量无限的的汽车,从第 i 个加油站开往第 i+1 个加油站需要消耗汽油 cost[i] 升。…
[LeetCode] Kth Largest Element in a Stream 数据流中的第K大的元素
Design a class to find the kth largest element in a stream. Note that it is the kth largest e…
[LeetCode] Couples Holding Hands 两两握手
N couples sit in 2N seats arranged in a row and want to hold hands. We want to know the minimum number …
力扣(LeetCode)763
题目地址:https://leetcode-cn.com/probl…题目描述:字符串 S 由小写字母组成。我们要把这个字符串划分为尽可能多的片段,同一个字母只会出现在其中的一个片段。返回一个表示每个字符串片…
2016.8.3 Leetcode (C++, Xcode)(1)344. Reverse String
因为一直写的都是android程序,所以之前想用java文件去提交,弄了半天android studio,终于将java程序运行了起来,可是一查,却发现java运行效率是c语言的三分之一。 OK,开始查刷OJ用什么语言比…
771. Jewels and Stones
题目网址:https://leetcode.com/problems/jewels-and-stones/description/ 大意:就是定义一个String J,这个String里面的每个character都是一种…