自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

ass673556617的专栏

近期记录一些leetcode上的题目,以及平时遇到的一些问题

  • 博客(62)
  • 资源 (12)
  • 收藏
  • 关注

原创 Lowest Common Ancestor of a Binary Tree

Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two node

2016-11-30 11:09:57 199

原创 Lowest Common Ancestor of a Binary Search Tree

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined betw

2016-11-30 10:59:17 150

原创 Swap Nodes in Pairs

Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space. Y

2016-11-28 05:49:19 199

原创 Triangle

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. NoticeBonus point if you are able to do this using only O(n) ex

2016-11-27 13:03:32 300

原创 word break

Given a string s and a dictionary of words dict, determine if s can be break into a space-separated sequence of one or more dictionary words.ExampleGiven s = "lintcode", dict = ["lint", "c

2016-11-27 12:37:20 205

原创 Clone Graph

Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes are labeled uniquely.We use # as a separator for each

2016-11-27 01:54:36 195

原创 Insert Interval

Given a non-overlapping interval list which is sorted by start point.Insert a new interval into it, make sure the list is still in order and non-overlapping (merge intervals if necessary).Have

2016-11-24 14:16:33 313

原创 Binary Tree Paths

Given a binary tree, return all root-to-leaf paths.Have you met this question in a real interview? YesExampleGiven the following binary tree: 1 / \2 3 \ 5Al

2016-11-24 14:05:24 170

原创 Remove Linked List Elements

Remove all elements from a linked list of integers that have value val.这道题是来自lintcode的,这题需要我们删除链表中某个值的元素。感觉不知道第几次写还是会有些迷茫,什么时候用两个指针,什么时候一个就足够了。这道题用两个能简单一些,代码如下:public ListNode removeElements(L

2016-11-24 13:09:36 194

原创 Merge Intervals

Given a collection of intervals, merge all overlapping intervals.Have you met this question in a real interview? YesExampleGiven intervals => merged intervals:[

2016-11-24 12:56:18 176

原创 Longest Increasing Subsequence

Given an unsorted array of integers, find the length of longest increasing subsequence.For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest increasing subsequence is [2, 3, 7, 101], ther

2016-11-23 14:04:12 220

原创 Implement Trie (Prefix Tree)

Implement a trie with insert, search, and startsWith methods.Note:You may assume that all inputs are consist of lowercase letters a-z.昨天做题做到word search 2,发现使用word[]作为字典的话会超时,后来参考网上发现这道题其实考

2016-11-23 10:03:52 308

原创 Partition List

Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes in each of the

2016-11-22 08:41:29 278

原创 Range Sum Query - Immutable

Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1sumRange(2, 5) -> -1sumRan

2016-11-22 03:48:17 227

原创 Combination Sum IV

Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target.Example:nums = [1, 2, 3]target = 4The pos

2016-11-22 02:09:41 159

原创 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.For example, given n = 12, return 3 because 12 = 4 + 4 + 4; given n =

2016-11-22 00:23:40 239

原创 Coin Change

You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money

2016-11-21 15:29:04 238

原创 Different Ways to Add Parentheses

Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *.Example 1

2016-11-21 14:58:15 201

原创 Unique Binary Search Trees II

Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should return all 5 unique BST's shown below. 1

2016-11-21 14:25:42 165

原创 Minimum Moves to Equal Array Elements II

Given a non-empty integer array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a selected element by 1 or decrementing a selected element by

2016-11-21 11:47:41 842

原创 Battleships in a Board

Given an 2D board, count how many different battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. You may assume the following rules:You receiv

2016-11-21 09:51:36 263

原创 Assign Cookies

Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a c

2016-11-21 08:00:18 306

原创 Island Perimeter

You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely

2016-11-21 07:45:11 1844

原创 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.Have you met this question in a re

2016-11-21 06:42:24 232

原创 Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return[ ["aa","b"],

2016-11-20 09:51:00 207

原创 Increasing Triplet Subsequence

Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array.Formally the function should:Return true if there exists i, j, k such that arr[i] ar

2016-11-20 05:16:18 241

原创 Find Right Interval

Given a set of intervals, for each of the interval i, check if there exists an interval j whose start point is bigger than or equal to the end point of the interval i, which can be called that j is on

2016-11-20 04:12:20 238

原创 Repeated Substring Pattern

Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowercase Engli

2016-11-20 01:43:38 376

原创 Non-overlapping Intervals

Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.Note:You may assume the interval's end point is alw

2016-11-18 03:54:44 703

原创 Product of Array Except Self

Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division and in O

2016-11-18 00:57:06 159

原创 Integer Break

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, given n = 2, ret

2016-11-16 08:36:55 218

原创 Reverse Second Half of Linked List

亚麻的一道OA题,觉得有必要再熟练几次。这个题主要考察两个地方。1.如何找到链表的中间位置,2.如何对链表进行反转。分开的两个部分都可以在leetcode的上找到类似的题,思路也比较清晰,注意奇数的时候中间点也需要翻转就好。代码: public ListNode reverseList(ListNode head) { if(head == null) return nu

2016-11-16 04:11:52 669

原创 Path Sum III

You are given a binary tree in which each node contains an integer value.Find the number of paths that sum to a given value.The path does not need to start or end at the root or a leaf, but it

2016-11-15 13:15:24 353

原创 Rectangle Area

Find the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.Assume that the tota

2016-11-13 10:41:29 297

原创 Convert Sorted Array to Binary Search Tree

Given an array where elements are sorted in ascending order, convert it to a height balanced BST.用分治法,二分法来构建。代码;public TreeNode sortedArrayToBST(int [] array ) { if(array == null)

2016-11-13 04:13:01 223

原创 Convert Sorted List to Binary Search Tree

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.喜闻乐见的使用二分来做。嫌麻烦,就把list转换成array来做。代码:public TreeNode sortedListToBST(ListNode head) {

2016-11-13 04:10:19 177

原创 Word Break

Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet"

2016-11-13 03:32:03 194

原创 Maximal Square

Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.For example, given the following matrix:1 0 1 0 01 0 1 1 11 1 1 1 11 0 0 1 0

2016-11-13 03:00:52 151

原创 Course Schedule II

There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as

2016-11-12 07:32:36 212

原创 Sum Root to Leaf Numbers

Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find the tota

2016-11-12 07:12:10 186

Unity3D Tetris 俄罗斯方块

在Umedy上找到一门Unity的入门课,跟着课程写了一个俄罗斯方块的游戏。涉及到unity的基本概念,以及particle模块。

2018-04-18

Angular4 英文教材 参考代码

这个是对应angular4那本英文教材的代码。我也是在网络上找到的,只是希望拿过来跟大家分享下,一起学习。我觉得angular对java基础还有注入依赖有经验的同学来说还是会觉得比较好接受。希望一起进步。

2017-11-07

Angular 股票管理

照着幕课网的内容写了一个demo。前端angular, 后端express, 样式Admin-LTE。只提供了查看的功能,修改跟添加功能不能同步到后端,等看完官网的表单部分再补充把。

2017-08-26

Angular4 Http

angular的http模块应用 参考教材以及代码 实现的youtube搜索框 启动: npm install, npm start

2017-08-10

angular form 表单例子

使用formbuilder创建一个表单

2017-07-19

angular4 教材 第二个inventory例子

还是基础的angular 的概念。没有加样式。

2017-07-07

angular4 教材 第一个reddit例子

angular4 教材第二章的例子 介绍基础的angular 用法

2017-07-05

Ang-bokk2 TheComplete Book on Angular 英文高清完整.pdf版

angular4 英文教材

2017-06-22

Angular4 表单demo

angular 4 官方教程里的表单例子

2017-06-09

Angular4 官方英雄编辑器

照着angular4 教程写的,对于HTTP部分RXJS部分表示很迷。

2017-06-02

django 1.8 polls 例子

根据django 1.8 官方事例做的小demo

2015-10-02

个人博客jsp实现

用了基础的jsp,servlet。数据库采用mysql。算是课下练习把。实现了文章阅读,评论,点赞。

2015-08-06

空空如也

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

TA关注的人

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