码迷,mamicode.com
首页 >  
搜索关键字:part solution    ( 14980个结果
剑指 Offer 45. 把数组排成最小的数
思路 本题解来自:面试题45. 把数组排成最小的数(自定义排序,清晰图解) 1 class Solution { 2 public: 3 string minNumber(vector<int>& nums) { 4 vector<string> vs; 5 for(int i = 0; i < n ...
分类:编程语言   时间:2020-11-08 17:55:22    阅读次数:27
LeetCode 78. 子集
class Solution { public List<List<Integer>> subsets(int[] nums) { List<List<Integer>> res = new ArrayList<>(); res.add(new ArrayList<>()); for(int i = ...
分类:其他好文   时间:2020-11-08 16:53:04    阅读次数:16
LeetCode #509. Fibonacci Number
###题目 509. Fibonacci Number ###解题方法 当成动态规划题来做,设置一个数组存储每轮计算后的fib数,从2开始遍历到N+1,然后返回最后一位即可。 ###代码 class Solution: def fib(self, N: int) -> int: if not N: ...
分类:其他好文   时间:2020-11-08 16:42:43    阅读次数:18
DSA 2020-7
若有恒,何必三更眠五更起; 最无益,莫过一日曝十日寒。 7.25 分割数组的最大值 区间dp 最大值可以方便的转移,所以可以直接应用区间dp 为什么这里的状态转移不一样? 对比最经典的区间dp 题目 石子合并 \[ j = i+l-1\\ dp[i][j] = \max_{k\in [i,j)}(d ...
分类:其他好文   时间:2020-11-07 16:44:26    阅读次数:18
题解 CF61B 【Hard Work】
Translation 判断字符串 \(s_1, s_2, s_3\) 能否通过首位相连的方式组成 \(t_i\)(不考虑大小写)。 Solution 首先,输入 $3$ 个字符串 \(s_1, s_2, s_3\),因为不考虑大小写,所以可以把它们全部都变成小写(这里以小写为例,大写也可以)。 接 ...
分类:其他好文   时间:2020-11-07 16:36:13    阅读次数:18
周练(11)70. 爬楼梯
# # @lc app=leetcode.cn id=70 lang=python3 # # [70] 爬楼梯 # # @lc code=start class Solution: def climbStairs(self, n: int) -> int: if n == 1: return 1 i ...
分类:其他好文   时间:2020-11-07 16:09:23    阅读次数:19
Leetcode(easy Double pointer)
Leetcode(easy Double pointer) Leetcode 双指针简单题目 26 删除排序数组中的重复项 class Solution{ public int removeDuplicates(int[] nums){ // step代表慢指针 int step = 0; // 这 ...
分类:其他好文   时间:2020-11-06 02:28:21    阅读次数:24
【题解】「AT4266」[ABC113B] Palace
AT4266 [ABC113B] Palace 水题解*n translation 有 \(n\) 个地方,第 \(i\) 个地方的海拔为 \(H_i\),该地方的温度为 \(T-H_i \times 0.006\)。 求哪个地方的温度离 \(A\) 最近。 solution 我们可以每次输入 \( ...
分类:其他好文   时间:2020-11-04 18:23:24    阅读次数:15
二分查找(C++实现)
class Solution { public: int peakIndexInMountainArray(vector<int>& arr) { int n = arr.size(); if(n==0) { return -1; } int left = 0; int right = n-1; w ...
分类:编程语言   时间:2020-11-04 17:43:48    阅读次数:26
LeetCode周赛#213
5554. 能否连接形成数组 题目链接 题意 给定整数数组 arr ,其中每个整数互不相同 。另有一个由整数数组构成的数组 pieces,其中的整数也互不相同 。请以 任意顺序 连接 pieces 中的数组以形成 arr 。但是,不允许 对每个数组内部 pieces[i] 中的整数重新排序。若可连接 ...
分类:其他好文   时间:2020-11-02 10:51:17    阅读次数:52
14980条   上一页 1 ... 41 42 43 44 45 ... 1498 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!