摘要: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: But the fol 阅读全文
posted @ 2018-03-14 08:01 轻风舞动 阅读(624) 评论(0) 推荐(0) 编辑
摘要: Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive intege 阅读全文
posted @ 2018-03-14 07:14 轻风舞动 阅读(1542) 评论(0) 推荐(0) 编辑
摘要: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Given linked list -- head = [4,5,1,9], wh 阅读全文
posted @ 2018-03-14 06:55 轻风舞动 阅读(916) 评论(0) 推荐(0) 编辑
摘要: Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your 阅读全文
posted @ 2018-03-14 06:26 轻风舞动 阅读(2218) 评论(0) 推荐(0) 编辑
摘要: Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example,Given 1->2 阅读全文
posted @ 2018-03-14 06:01 轻风舞动 阅读(414) 评论(0) 推荐(0) 编辑
摘要: Given a sorted linked list, delete all duplicates such that each element appear only once. Example 1: Example 2: 移除有序链表中的重复项,返回新链表。定义1个指针指向链表的第一个元素,然后 阅读全文
posted @ 2018-03-14 05:52 轻风舞动 阅读(301) 评论(0) 推荐(0) 编辑
摘要: Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice and return the new length. Do not allocate extra 阅读全文
posted @ 2018-03-14 05:42 轻风舞动 阅读(332) 评论(0) 推荐(0) 编辑
摘要: 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 spa 阅读全文
posted @ 2018-03-14 05:33 轻风舞动 阅读(480) 评论(0) 推荐(0) 编辑
摘要: Given an integer n, generate a square matrix filled with elements from 1 to n^2 in spiral order. For example,Given n = 3, You should return the follow 阅读全文
posted @ 2018-03-14 02:57 轻风舞动 阅读(435) 评论(0) 推荐(0) 编辑
摘要: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example,Given the following matrix: You s 阅读全文
posted @ 2018-03-14 02:48 轻风舞动 阅读(2465) 评论(0) 推荐(0) 编辑
摘要: You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Note: You have to rotate the image in-place, which 阅读全文
posted @ 2018-03-14 02:27 轻风舞动 阅读(2086) 评论(0) 推荐(0) 编辑