
leetcode
拼了命的珍惜
力气大的搬砖男子汉。
展开
-
【java-海明距离】477. Total Hamming Distance
The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Now your job is to find the total Hamming distance between all pairs of the given numbers.Example:Input: 4, 14, 2Output: 6Explanation: I原创 2020-07-05 15:58:41 · 225 阅读 · 0 评论 -
【java-动态规划】62. Unique Paths
A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked ‘Finish’ in the dia原创 2020-07-05 15:06:53 · 240 阅读 · 0 评论 -
【split分割】468. Validate IP Address
Write a function to check whether an input string is a valid IPv4 address or IPv6 address or neither.IPv4 addresses are canonically represented in dot-decimal notation, which consists of four decimal numbers, each ranging from 0 to 255, separated by dots原创 2020-07-03 22:15:19 · 225 阅读 · 0 评论 -
【java-快速幂】50. Pow(x, n)
Implement pow(x, n), which calculates x raised to the power n (xn).Example 1:Input: 2.00000, 10Output: 1024.00000Example 2:Input: 2.10000, 3Output: 9.26100Example 3:Input: 2.00000, -2Output: 0.25000Explanation: 2-2 = 1/22 = 1/4 = 0.25Note:-100.原创 2020-07-03 12:26:16 · 238 阅读 · 0 评论 -
[快速排序]148. Sort List
Sort a linked list in O(n log n) time using constant space complexity.Example 1:Input: 4->2->1->3Output: 1->2->3->4Example 2:Input: -1->5->3->4->0Output: -1->0->3->4->5/** * Definition for singly-linked lis原创 2020-07-02 22:31:25 · 200 阅读 · 0 评论 -
【暴力法】8. String to Integer (atoi)
Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign原创 2020-07-01 23:17:08 · 230 阅读 · 0 评论