摘要: 1、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 r 阅读全文
posted @ 2018-07-26 21:43 Lin.B 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 1、判断一个迷宫是否有出口 这个题目是我自己编的,leetcode上并没有这样的题目。为了锻炼自己的DFS,这个题目应该还是比较简单的,用深搜就可以完成,和之前做的max area of island有异曲同工之妙。 poll出迷宫问题: 、 如图所示的迷宫,0代表可以走,1代表有墙。要求从左上角到 阅读全文
posted @ 2018-07-25 22:12 Lin.B 阅读(1424) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo 阅读全文
posted @ 2018-07-25 17:56 Lin.B 阅读(119) 评论(0) 推荐(0) 编辑
摘要: Given a directed, acyclic graph of N nodes. Find all possible paths from node 0 to node N-1, and return them in any order. The graph is given as follo 阅读全文
posted @ 2018-07-25 16:58 Lin.B 阅读(124) 评论(0) 推荐(0) 编辑
摘要: A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the 阅读全文
posted @ 2018-07-24 14:12 Lin.B 阅读(115) 评论(0) 推荐(0) 编辑
摘要: Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. Example: Input: 阅读全文
posted @ 2018-07-23 18:18 Lin.B 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 今天总结一下用Floyd算法来判断链表中是否有环,如果有环,如何找到环的入口。这一系列问题。 1、Linked List Cycle Ⅰ Given a linked list, determine if it has a cycle in it. Follow up:Can you solve i 阅读全文
posted @ 2018-07-23 17:28 Lin.B 阅读(159) 评论(0) 推荐(0) 编辑
摘要: Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. 阅读全文
posted @ 2018-07-23 16:23 Lin.B 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 今天来总结一下Missing Number一系列问题 1、Find All Numbers Disappeared in an Array Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements 阅读全文
posted @ 2018-07-23 15:54 Lin.B 阅读(232) 评论(0) 推荐(0) 编辑
摘要: Given an array consists of non-negative integers, your task is to count the number of triplets chosen from the array that can make triangles if we tak 阅读全文
posted @ 2018-07-19 17:56 Lin.B 阅读(135) 评论(0) 推荐(0) 编辑