随笔分类 -  Leetcode

Let coding become one of my hobby and part of my daily life.
摘要:Problem: Reverse a singly linked list. recursion: 阅读全文
posted @ 2016-06-06 10:05 liu_ty10 阅读(129) 评论(0) 推荐(0)
摘要:Problem: Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. Note: E 阅读全文
posted @ 2016-06-03 00:44 liu_ty10 阅读(132) 评论(0) 推荐(0)
摘要:Problem: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice i 阅读全文
posted @ 2016-06-01 19:18 liu_ty10 阅读(179) 评论(0) 推荐(0)
摘要:Problem: 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 阅读全文
posted @ 2016-06-01 18:51 liu_ty10 阅读(139) 评论(0) 推荐(0)
摘要:Problem: Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For ex 阅读全文
posted @ 2016-05-30 21:03 liu_ty10 阅读(150) 评论(0) 推荐(0)
摘要:Problem: Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = "anagram", t = "nagaram", return true.s = " 阅读全文
posted @ 2016-05-29 20:45 liu_ty10 阅读(101) 评论(0) 推荐(0)
摘要:Problem: Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally id 阅读全文
posted @ 2016-05-29 20:21 liu_ty10 阅读(94) 评论(0) 推荐(0)
摘要:Problem: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 阅读全文
posted @ 2016-05-28 00:10 liu_ty10 阅读(110) 评论(0) 推荐(0)
摘要:Problem: 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. For exa 阅读全文
posted @ 2016-05-27 23:49 liu_ty10 阅读(125) 评论(0) 推荐(0)
摘要:Problem: Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each 阅读全文
posted @ 2016-05-26 00:45 liu_ty10 阅读(171) 评论(1) 推荐(0)
摘要:Problem: Invert a binary tree. to One Possible Solution: 阅读全文
posted @ 2016-05-25 18:50 liu_ty10 阅读(98) 评论(0) 推荐(0)
摘要:Problem: 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 f 阅读全文
posted @ 2016-05-23 19:44 liu_ty10 阅读(91) 评论(0) 推荐(0)
摘要:Problem: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process 阅读全文
posted @ 2016-05-22 20:56 liu_ty10 阅读(113) 评论(0) 推荐(0)
摘要:Problem: You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 阅读全文
posted @ 2016-05-22 01:01 liu_ty10 阅读(132) 评论(0) 推荐(0)
摘要:Problem: Write a function that takes a string as input and returns the string reversed. Example: Given s = "hello", return "olleh". One possible Solut 阅读全文
posted @ 2016-05-21 00:39 liu_ty10 阅读(144) 评论(0) 推荐(0)