
Leetcode刷题之旅
乾月
学生一只,后来到福报厂了
展开
-
476. Number Complement(给一个数字求反)
给定一个正整数,输出其补码。补码策略是翻转其二进制表示的位。 注意: 给定的整数保证在32位有符号整数的范围内。 您可以假定整数二进制表示中没有前导零位。 示例1: 输入: 5 输出:2 说明:5的二进制表示为101(无前导零位),其补码为010,所以需要输出2。 示例2: 输入: 1 输出: 0 说明:1的二进制表示为1(无前导零原创 2017-09-13 16:44:32 · 433 阅读 · 0 评论 -
237. Delete Node in a Linked List
Writea function to delete a node (except the tail) in a singly linked list, givenonly access to that node. Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given thethird node with value原创 2017-09-13 16:52:34 · 179 阅读 · 0 评论 -
561. Array Partition I (数组分组)
Given an array of 2n integers, your task is to groupthese integers into n pairsof integer, say (a1, b1), (a2, b2),..., (an, bn) which makes sum of min(ai, bi) forall i from 1 to n as large as po原创 2017-09-13 16:54:39 · 203 阅读 · 0 评论 -
7. Reverse Integer (翻转一个整数)
Reverse digits of aninteger. Example1: x = 123, return 321 Example2: x = -123, return -321 给你一个整数,返后它倒序的数字 最好就是用数学运算来解决这个问题,让这个数循环除以10取余,然后让输出的数字循环乘以10然后加上当前取余的结果,是一种类似位运算的思想,可以原创 2017-09-13 16:55:05 · 233 阅读 · 0 评论 -
461. Hamming Distance(汉明距离)
The Hammingdistance between two integers is the number of positions atwhich the corresponding bits are different. Given two integers x and y, calculate the Hamming distance. Note: 0 ≤ x, y < 2原创 2017-09-13 16:55:27 · 397 阅读 · 0 评论 -
412. Fizz Buzz
Write a program thatoutputs the string representation of numbers from 1 to n. But for multiples of threeit should output “Fizz” instead of the number and for the multiples of fiveoutput “Buzz”. For n原创 2017-09-13 16:56:12 · 302 阅读 · 0 评论 -
160. Intersection of Two Linked Lists(java)
Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: A: a1 → a2 ↘ ...原创 2018-08-20 12:01:15 · 373 阅读 · 0 评论