自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

打得一手好铁

olliego.com

  • 博客(206)
  • 收藏
  • 关注

转载 唐纳德·霍尔《踢树叶》

踢树叶 唐纳德.霍尔 一   踢树叶,十月里的一天,在安阿伯 我们看完比赛,一起走回家, 天色黑如煤炱,空中饱含雨意; 我踢枫树的叶子,红的有七十种层次 黄的像张旧报纸;杨树的叶子,既脆又白 还有榆树叶,像注定要灭绝的种族的破旗 我踢树叶,发出一种我熟悉的声音 当树叶从我的靴前盘旋升起 然后纷纷落下,于是我记起 有几年的十月,在康涅狄格我走去上学 穿

2015-12-26 19:23:02 2040

原创 297. 二叉树的序列化与反序列化

序列化是将一个数据结构或者对象转换为连续的比特位的操作,进而可以将转换后的数据存储在一个文件或者内存中,同时也可以通过网络传输到另一个计算机环境,采取相反方式重构得到原数据。 请设计一个算法来实现二叉树的序列化与反序列化。这里不限定你的序列 / 反序列化算法执行逻辑,你只需要保证一个二叉树可以被序列化为一个字符串并且将这个字符串反序列化为原始的树结构。 示例: 你可以将以下二叉树: 1 / \ 2 3 / \ 4 5 序列化为 "[1,2,3,null,...

2020-06-17 11:49:43 277 1

原创 572. 另一个树的子树

给定两个非空二叉树 s 和 t,检验 s 中是否包含和 t 具有相同结构和节点值的子树。s 的一个子树包括 s 的一个节点和这个节点的所有子孙。s 也可以看做它自身的一棵子树。 示例 1: 给定的树 s: 3 / \ 4 5 / \ 1 2 给定的树 t: 4 / \ 1 2 返回 true,因为 t 与 s 的一个子树拥有相同的结构...

2020-05-07 17:57:06 241

原创 Leetcode 42 接雨水

给定 n 个非负整数表示每个宽度为 1 的柱子的高度图,计算按此排列的柱子,下雨之后能接多少雨水。 上面是由数组 [0,1,0,2,1,0,1,3,2,1,2,1] 表示的高度图,在这种情况下,可以接 6 个单位的雨水(蓝色部分表示雨水)。 感谢 Marcos 贡献此图。 示例: 输入: [0,1,0,2,1,0,1,3,2,1,2,1] 输出: 6 对于数组中的每个元素,我们找出下雨...

2020-04-05 00:07:09 240

原创 LeetCode 232. Implement Queue using Stacks

Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue. pop() -- Removes the element from in front of queue. peek() -- Get the front element. em...

2020-03-20 22:33:19 324

原创 LeetCode 657.Robot Return to Origin

There is a robot starting at position (0, 0), the origin, on a 2D plane. Given a sequence of its moves, judge if this robot ends up at (0, 0) after it completes its moves. The move sequence is repres...

2020-03-19 23:52:13 174

原创 LeetCode 219. Contains Duplicate II

Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference between i and j is at most k. ...

2020-03-18 16:43:16 210

原创 LeetCode 206. Reverse Linked List

Reverse a singly linked list. Example: Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL Follow up: A linked list can be reversed either iteratively or recursi...

2020-03-17 10:58:45 187

原创 LeetCode 203. Remove Linked List Elements

Remove all elements from a linked list of integers that have value val. Example: Input: 1->2->6->3->4->5->6, val = 6 Output: 1->2->3->4->5 //java /** * Definition...

2020-03-17 09:44:21 219

原创 LeetCode 198. House Robber

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house...

2020-03-16 10:46:25 148

原创 LeetCode 1295. Find Numbers with Even Number of Digits

Given an array nums of integers, return how many of them contain an even number of digits. Example 1: Input: nums = [12,345,2,6,7896] Output: 2 Explanation: 12 contains 2 digits (even number of...

2020-03-15 23:39:41 825

原创 LeetCode 191. Number of 1 Bits

Write a function that takes an unsigned integer and returnthe number of '1'bits it has (also known as the Hamming weight). Example 1: Input: 00000000000000000000000000001011 Output: 3 Explanat...

2020-03-14 16:47:22 171

原创 LeetCode 172. Factorial Trailing Zeroes

Given an integer n, return the number of trailing zeroes in n!. Example 1: Input: 3 Output: 0 Explanation:3! = 6, no trailing zero. Example 2: Input: 5 Output: 1 Explanation:5! = 120, one trai...

2020-03-14 09:53:57 142

原创 LeetCode 169. Majority Element

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 majority element alwa...

2020-03-13 16:52:55 253

原创 LeetCode 167. Two Sum II - Input array is sorted

Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers ...

2020-03-12 12:22:26 146

原创 LeetCode 155. Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack. top() -- Ge...

2020-03-11 12:57:50 206

原创 LeetCode 136. Single Number

Given a non-emptyarray 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 without us...

2020-03-10 10:14:34 164

原创 LeetCode 125. Valid Palindrome

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Note:For the purpose of this problem, we define empty string as valid palindrome. Examp...

2020-03-09 13:42:01 191

原创 LeetCode 122. Best Time to Buy and Sell Stock II

Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e., buy on...

2020-03-08 12:30:36 179

原创 LeetCode 121. Best Time to Buy and Sell Stock

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 transaction (i.e., buy one and sell one share of the stock),...

2020-03-07 09:17:25 151

原创 LeetCode 104. Maximum Depth of Binary Tree

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 farthest leaf node. Note:A leaf is a node with no childre...

2020-03-06 14:27:14 145

原创 LeetCode 88. Merge Sorted Array

Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: The number of elements initialized in nums1 and nums2 are m and n respectively. You may assume tha...

2020-03-05 23:55:33 136

原创 LeetCode 53. Maximum Subarray

Given an integer array nums, find the contiguous subarray(containing at least one number) which has the largest sum and return its sum. Example: Input: [-2,1,-3,4,-1,2,1,-5,4], Output: 6 Explanati...

2020-03-05 16:23:16 182

原创 LeetCode 804. Unique Morse Code Words

International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ".-", "b" maps to "-...", "c" maps to "-.-.", and so on. For c...

2019-07-31 16:05:46 223

原创 LeetCode 279. Perfect Squares

Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. Example 1: Input: n = 12 Output: 3 Explanation: 12 = 4 + 4 + 4. Example...

2019-06-26 14:42:50 266

原创 LeetCode 1021. Remove Outermost Parentheses

A valid parentheses string is either empty (""), "(" + A + ")", or A + B, where A and B are valid parentheses strings, and + represents string concatenation. For example, "", "()", "(())()", and "(()...

2019-06-24 23:02:04 233

原创 LeetCode 27. Remove Element

Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must do this by modifying the input arra...

2019-06-23 22:53:12 185

原创 LeetCode 709. To Lower Case

Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. Example 1: Input: "Hello" Output: "hello" Example 2: Input: "here" Output: "here" ...

2019-06-11 13:23:23 206

原创 LeetCode 938. Range Sum of BST

Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive). The binary search tree is guaranteed to have unique values. Example 1: ...

2019-06-10 17:32:19 299

原创 LeetCode 771. Jewels and Stones

You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the sto...

2019-06-10 16:13:25 114

原创 LeetCode 26. Remove Duplicates from Sorted Array

Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this by modifyi...

2019-06-05 23:12:07 127

原创 LeetCode 21. Merge Two Sorted Lists

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. Example: Input: 1->2->4, 1->3->4 Output: 1-...

2019-06-04 23:14:56 110

原创 LeetCode 20. Valid Parentheses

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of b...

2019-05-29 15:10:50 112

原创 LeetCode 14. Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Example 1: Input: ["flower","flow","flight"] Output:...

2019-05-28 23:08:05 122

原创 LeetCode 13. Roman to Integer

Roman numerals are represented by seven different symbols:I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D ...

2019-05-28 15:50:01 266

原创 Spring MVC 和 Spring 总结

1. 为什么使用Spring ? 1). 方便解耦,简化开发 通过Spring提供的IoC容器,可以将对象之间的依赖关系交由Spring进行控制,避免硬编码所造成的过度程序耦合。 2). AOP编程的支持 通过Spring提供的AOP功能,方便进行面向切面的编程,如性能监测、事务管理、日志记录等。 3). 声明式事务的支持 ...

2019-05-27 12:06:14 136

原创 C++产生随机数

函数一:int rand(void); 从srand (seed)中指定的seed开始,返回一个 ( seed, RAND_MAX(0x7fff))间的随机整数。 函数二:void srand(unsigned seed); 参数seed是rand()的种子,用来初始化rand()的起始值。 大致过程如下: rand()在每次被调用的时,它会查看: (1)如果用户在此之前调用过...

2019-05-19 22:21:41 13951 1

原创 LeetCode 7. Reverse Integer

Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 Note: Assume we are dea...

2019-04-21 01:34:51 127

原创 LeetCode 3. Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2: ...

2019-04-17 16:53:13 125

原创 LeetCode 2. Add Two Numbers

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return i...

2019-04-16 00:35:17 277

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除