
Java
Seazzy5461
这个作者很懒,什么都没留下…
展开
-
LeetCode——Two Sum
LeetCode——Two SumGiven an array of integers, return indices of the two numbers such that they add up to a specific target.原创 2017-10-29 11:47:03 · 570 阅读 · 0 评论 -
LeetCode——Palindrome Linked List
LeetCode——Palindrome Linked List # 234 Given a singly linked list, determine if it is a palindrome. Follow up: Could you do it in O(n) time and O(1) space?这一题的目的是判断一个单链表是否是回文链表,并且最好是在O(原创 2017-11-25 16:06:46 · 271 阅读 · 0 评论 -
LeetCode——Reverse Linked List
LeetCode——Reverse Linked List # 206 Reverse a singly linked list.这一题的目的是反转一个单链表。是对链表操作的一个经典题目。第一个想到的思路是利用一个栈。C++语言中用栈实现的话,我只能将val保存到栈中,因为指针的问题,我解决的不好,但是Java的话,因为不用指针,就可以轻松地写出来。所以下面两个版本,其实不太一样。P原创 2017-11-21 23:28:38 · 238 阅读 · 0 评论 -
LeetCode——Merge Two Binary Trees
LeetCode——Merge Two Binary Trees # 617 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.原创 2017-11-20 23:19:27 · 234 阅读 · 0 评论 -
LeetCode——Balanced Binary Tree
LeetCode——Balanced Binary Tree #110 Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth o原创 2017-11-15 23:12:58 · 280 阅读 · 0 评论 -
LeetCode——Maxium Depth of Binary Tree
LeetCode——Maxium Depth of Binary Tree # 104 Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthes原创 2017-11-14 11:44:44 · 295 阅读 · 0 评论 -
LeetCode——Linked List Cycle
LeetCode——Linked List Cycle #141 Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? 这一题的目的是判断链表中是否有环。一个思路是利用哈希表。如果遍历过的结点已经存在了原创 2017-11-19 21:43:28 · 225 阅读 · 0 评论 -
LeetCode——Best Time to Buy and Sell Stock
LeetCode——Best Time to Buy and Sell Stock # 121 Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one t原创 2017-11-18 22:39:00 · 276 阅读 · 0 评论 -
LeetCode——Subtree of Another
LeetCode——Subtree of Another Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree consists of a原创 2017-11-12 23:06:08 · 269 阅读 · 0 评论 -
LeetCode——Maximum subarray
LeetCode——Maximum Subarray # 53 Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4],原创 2017-11-04 18:09:10 · 260 阅读 · 0 评论 -
LeetCode——Climbing Stairs
LeetCode——Climbing Stairs # 70 You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to t原创 2017-11-01 22:32:12 · 255 阅读 · 0 评论 -
LeetCode——Merge Two Sorted Lists
LeetCode——Merge Two Sorted Lists #21 Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.原创 2017-11-01 22:20:34 · 237 阅读 · 0 评论 -
LeetCode——Single Numeber
LeetCode——Single Number # 136 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. Co原创 2017-11-07 21:47:08 · 236 阅读 · 0 评论 -
LeetCode——Valid Parenthese
Leetcode——Valid Parenthese #20 Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.原创 2017-10-29 19:11:08 · 427 阅读 · 0 评论 -
今日头条校招真题——字典序
牛客网编程题——字典序题目描述 给定整数n和m, 将1到n的这n个整数按字典序排列之后, 求其中的第m个数。 对于n=11, m=4, 按字典序排列依次为1, 10, 11, 2, 3, 4, 5, 6, 7, 8, 9, 因此第4个数是2. 对于n=200, m=25, 按字典序排列依次为1 10 100 101 102 103 104 105 106 107 108 ...原创 2018-08-24 11:23:02 · 547 阅读 · 0 评论