算法
文章平均质量分 54
weixin_31065637
计算机科学与技术
展开
-
leetcode 136. Single Number
题目:Given a non-empty array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without usi...原创 2018-07-16 15:06:53 · 113 阅读 · 0 评论 -
leetcode 400. Nth Digit
题目: Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note:n is positive and will fit within the range of a 32-bit signed integer (n < 231). 正整数依次排列,找到第n...原创 2018-07-21 12:58:41 · 88 阅读 · 0 评论 -
leetcode 670. 最大交换
题目:给定一个非负整数,你至多可以交换一次数字中的任意两位。返回你能得到的最大值。 示例 1 : 输入: 2736 输出: 7236 解释: 交换数字2和数字7。 方法:从最高位开始,在后面找到最大的数,如果比该位数大则交换位置。 注意:后面可能有多个相同的最大的数,要选择最低位的那个。 int maximumSwap(int num) { vector<int&...原创 2018-08-09 14:45:45 · 809 阅读 · 0 评论