两整数之和。题意是不用加减法做到对两个整数求和。思路是位运算,但是非常难想,需要复习。我是参考了这个帖子才想通了的。 ab低位进位 0 0 0 0 1 0 1 0 0 1 1 0 1 1 0 1 首先注意到,任意两个数字a和b相加的时候,他们的低位和高位的结果是什么?如上图所示,你会发现一个规律,低 ...
分类:
其他好文 时间:
2020-04-30 13:14:31
阅读次数:
53
Given a string that?only?contains "I" (increase) or "D" (decrease), let . Return?any?permutation of such that for all : If , then Example 1: Example 2 ...
分类:
其他好文 时间:
2020-04-30 10:00:11
阅读次数:
88
Problem : Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole arra ...
分类:
其他好文 时间:
2020-04-29 23:08:17
阅读次数:
65
Problem : Given a string, find the length of the longest substring without repeating characters. Example 1: Example 2: Example 3: 思路 : Solution (C++) ...
分类:
其他好文 时间:
2020-04-29 21:42:00
阅读次数:
51
package builtintype error interface { Error() string }######################error接口定义 package errors // New returns an error that formats as the given ...
分类:
其他好文 时间:
2020-04-29 20:14:15
阅读次数:
68
题目描述 将给定的链表中每两个相邻的节点交换一次,返回链表的头指针例如,给出1->2->3->4,你应该返回链表2->1->4->3。你给出的算法只能使用常量级的空间。你不能修改列表中的值,只能修改节点本身。 Given a linked list, swap every two adjacent ...
分类:
其他好文 时间:
2020-04-29 00:52:16
阅读次数:
76
题目英文版: The only difference between the easy and the hard versions is the maximum value of k. You are given an infinite sequence of form "1121231234123 ...
分类:
其他好文 时间:
2020-04-28 12:33:44
阅读次数:
91
This time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral matrix is filled in from the fi ...
分类:
其他好文 时间:
2020-04-28 00:48:51
阅读次数:
67
题目描述 The only difference between the easy and the hard versions is the maximum value of k. You are given an infinite sequence of form "112123123412345 ...
分类:
其他好文 时间:
2020-04-27 22:17:24
阅读次数:
94
Given an array of integers, return if and only if it is a valid mountain array . Recall that A is a mountain array if and only if: There exists some w ...
分类:
编程语言 时间:
2020-04-27 10:02:23
阅读次数:
120