原题链接在这里:https://leetcode.com/problems/previous-permutation-with-one-swap/ 题目: Given an array A of positive integers (not necessarily distinct), return ...
分类:
其他好文 时间:
2020-01-05 09:32:35
阅读次数:
73
/** *543. Diameter of Binary Tree * https://leetcode.com/problems/diameter-of-binary-tree/description/ * */class TreeNode(var `val`: Int) { var left: ...
分类:
其他好文 时间:
2020-01-05 09:22:24
阅读次数:
78
原题链接在这里:https://leetcode.com/problems/jewels-and-stones/ 题目: You're given strings J representing the types of stones that are jewels, and S representi ...
分类:
其他好文 时间:
2020-01-05 09:21:37
阅读次数:
78
231. Power of Two(2的幂) 链接 https://leetcode cn.com/problems/power of two 题目 给定一个整数,编写一个函数来判断它是否是 2 的幂次方。 示例?1: 输入: 1 输出: true 解释: 20?= 1 示例 2: 输入: 16 输 ...
分类:
其他好文 时间:
2020-01-04 16:34:47
阅读次数:
56
给定一个字符串 s 与正整数 k。现在你需要进行恰好一次操作:
(1)将 s 切割成最多 k 个子串。即令 s = t1 + t2 + ... + tm (1 <= m <= k)。
(2)将其中的某些(不是全部) ti 翻转,得到 ti'。
(3)重新拼合得到 s' = t1' + t2' + ... ...
分类:
其他好文 时间:
2020-01-04 16:33:53
阅读次数:
69
合并?k?个排序链表,返回合并后的排序链表。请分析和描述算法的复杂度。 示例: 链接:https://leetcode cn.com/problems/merge k sorted lists 自己的思路 在k个链表中找到一个比较节点,然后把k个链表分成两部分,一部分都比比较节点小,一部分都比比较节 ...
分类:
编程语言 时间:
2020-01-04 16:17:48
阅读次数:
90
ABC059D "Alice & Brown" In this game, there are two piles initially consisting of $X$ and $Y$ stones, respectively. Alice and Brown alternately perfor ...
分类:
其他好文 时间:
2020-01-04 01:17:34
阅读次数:
62
Problems of the Miklós Schweitzer Memorial Competition 匈牙利竞赛 罗马尼亚试题 ...
分类:
其他好文 时间:
2020-01-03 22:43:25
阅读次数:
137
给定一个链表,删除链表的倒数第 n 个节点,并且返回链表的头结点。 链接 https://leetcode cn.com/problems/remove nth node from end of list/ 凑数吧 ...
分类:
其他好文 时间:
2020-01-02 22:54:45
阅读次数:
131
7-37 整数分解为若干项之和 (20分) https://pintia.cn/problem-sets/14/problems/2990 1 #include<iostream> 2 using namespace std; 3 int sum=0,pos=-1,countN=0,N;//定义试探 ...
分类:
其他好文 时间:
2020-01-02 22:41:11
阅读次数:
81