算法题库
文章平均质量分 62
prisonsona
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
lintcode/leetcode由易至难第22题:Complex Number Multiplication
Problem: Given two strings representing two complex numbers. You need to return a string representing their multiplication. Note i2 = -1 according to the definition. Example 1: Input: "1原创 2017-07-10 20:47:16 · 228 阅读 · 0 评论 -
lintcode/leetcode由易至难第5题:Hamming Distance
Problem: The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calculate the Hamming distance.原创 2017-06-06 18:23:03 · 202 阅读 · 0 评论 -
lintcode/leetcode由易至难第4题:Array Partition I
题目: Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as原创 2017-06-06 14:04:38 · 174 阅读 · 0 评论 -
lintcode/leetcode由易至难第3题:选择排序
public class Solution { /** * @param A an integer array * @return void */ //重点是记录指针!!!!派一个指针不断向后找 public void sortIntegers(int[] A) { // Write your code here原创 2017-05-08 14:18:09 · 390 阅读 · 0 评论 -
lintcode/leetcode由易至难第2题:冒泡排序
public class Solution { /** * @param A an integer array * @return void */ public void sortIntegers(int[] A) { // Write your code here if (A == null) return;原创 2017-05-08 11:04:59 · 1243 阅读 · 0 评论 -
lintcode/leetcode由易至难第1题:返回第n个斐波那契数
class Solution { /** * @param n: an integer * @return an integer f(n) */ public int fibonacci(int n) { // write your code here if(n == 1) return 0; if(n == 2) re原创 2017-04-23 17:01:16 · 447 阅读 · 0 评论 -
lintcode/leetcode由易至难第21题:Encode and Decode TinyURL
Problem: Note: This is a companion problem to the System Design problem: Design TinyURL. TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problems/desig原创 2017-07-03 08:42:43 · 433 阅读 · 0 评论 -
lintcode/leetcode由易至难第17题:Counting Bits
Problem: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array. Example:原创 2017-06-26 18:07:08 · 208 阅读 · 0 评论 -
lintcode/leetcode由易至难第18题:Find Bottom Left Tree Value
Problem: Given a binary tree, find the leftmost value in the last row of the tree. Example 1: Input: 2 / \ 1 3 Output: 1 Example 2: Input: 1 / \原创 2017-06-26 18:55:01 · 201 阅读 · 0 评论 -
lintcode/leetcode由易至难第19题:Teemo Attacking
Problem: In LLP world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo's attacking ascending time series towards Ashe and the p原创 2017-06-26 22:02:02 · 193 阅读 · 0 评论 -
lintcode/leetcode由易至难第6题:Number Complement
Problems: Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: The given integer is guaranteed to fit wi原创 2017-06-06 22:50:44 · 251 阅读 · 0 评论 -
lintcode/leetcode由易至难第7题:Distribute Candies
Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of the corresponding kind. You need to distribute the原创 2017-06-07 12:07:36 · 293 阅读 · 0 评论 -
lintcode/leetcode由易至难第16题:Reshape the Matrix
Problem;: In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data. You're given a matrix represent原创 2017-06-21 20:25:51 · 188 阅读 · 0 评论 -
lintcode/leetcode由易至难第15题:Merge Two Binary Trees
Problem: Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not. You need to merge them into a原创 2017-06-21 19:52:14 · 213 阅读 · 0 评论 -
lintcode/leetcode由易至难第14题:Single Number
Problem: Given an 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 wit原创 2017-06-08 14:51:13 · 205 阅读 · 0 评论 -
lintcode/leetcode由易至难第13题:Max Consecutive Ones
Problem: Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1] Output: 3 Explanation: The first two digits or the last three digits原创 2017-06-08 14:29:12 · 270 阅读 · 0 评论 -
lintcode/leetcode由易至难第12题:Majority Element
Problem: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and the maj原创 2017-06-08 09:52:29 · 240 阅读 · 0 评论 -
lintcode/leetcode由易至难第11题:Same Tree
Problem: Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same value.原创 2017-06-08 09:38:27 · 249 阅读 · 0 评论 -
lintcode/leetcode由易至难第10题:Delete Node in a Linked List
Problem: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third n原创 2017-06-08 09:16:18 · 249 阅读 · 0 评论 -
lintcode/leetcode由易至难第9题:Nim Game
Problem: You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone原创 2017-06-07 22:24:52 · 240 阅读 · 0 评论 -
lintcode/leetcode由易至难第8题:Reverse String
Problem: Write a function that takes a string as input and returns the string reversed. Example: Given s = "hello", return "olleh". Code: public class Solution { public String reverseSt原创 2017-06-07 20:30:45 · 283 阅读 · 0 评论 -
lintcode/leetcode由易至难第20题:Integer Break
Problem: Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get. For example, gi原创 2017-06-26 22:53:10 · 233 阅读 · 0 评论
分享