摘要:
来源:https://leetcode.com/problems/symmetric-tree Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For exa 阅读全文
摘要:
来源:https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree Given a binary tree, find the lowest common ancestor (LCA) of two given nodes 阅读全文
摘要:
来源:https://leetcode.com/problems/implement-queue-using-stacks Implement the following operations of a queue using stacks. push(x) -- Push element x to 阅读全文
摘要:
判断链表中是否有环 来源:https://leetcode.com/problems/linked list cycle Given a linked list, determine if it has a cycle in it. 一块一慢两个指针,如果有环,两个指针必定会在某个时刻相同且都不为空 阅读全文
摘要:
来源:https://leetcode.com/problems/intersection of two linked lists Write a program to find the node at which the intersection of two singly linked list 阅读全文
摘要:
来源:https://leetcode.com/problems/maximum subarray Find the contiguous subarray within an array (containing at least one number) which has the largest 阅读全文
摘要:
来源:https://leetcode.com/problems/convert a number to hexadecimal Given an integer, write an algorithm to convert it to hexadecimal. For negative integ 阅读全文
摘要:
来源:https://leetcode.com/problems/climbing stairs You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 阅读全文
摘要:
1. 去掉首位空格 2. 判断首位是否有正负号 3. 判断各位是否是0~9,有其他字符直接返回当前结果 1 public class Solution { 2 public int atoi(String str) { 3 str = str.trim(); 4 int result = 0; 5 阅读全文