随笔分类 -  算法

leetcode 88 Merge Sorted Array
摘要:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note:You may assume that nums1 has enough space (size tha 阅读全文
posted @ 2018-03-16 14:58 gtxvs 阅读(157) 评论(0) 推荐(0)
leetcode 94 Binary Tree Inorder Traversal
摘要:Given a binary tree, return the inorder traversal of its nodes' values. For example:Given binary tree [1,null,2,3], return [1,3,2]. 用的递归方法,提示上说递归方法太普通 阅读全文
posted @ 2018-03-16 00:11 gtxvs 阅读(131) 评论(0) 推荐(0)
leetcode 100. Same Tree
摘要:Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally ident 阅读全文
posted @ 2018-03-14 22:29 gtxvs 阅读(116) 评论(0) 推荐(0)
leetcode 21. Merge Two Sorted Lists
摘要:问题描述: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 代码 阅读全文
posted @ 2017-12-05 11:06 gtxvs 阅读(120) 评论(0) 推荐(0)
leetcode 27. Remove Element
摘要:问题描述: Given an array and a value, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array 阅读全文
posted @ 2017-12-05 11:04 gtxvs 阅读(156) 评论(0) 推荐(0)
leetcode 461. Hamming Distance
摘要:问题描述: The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, 阅读全文
posted @ 2017-12-05 11:03 gtxvs 阅读(138) 评论(0) 推荐(0)
leetcode 191. Number of 1 Bits
摘要:问题描述: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 3 阅读全文
posted @ 2017-12-05 11:01 gtxvs 阅读(148) 评论(0) 推荐(0)
leetcode 26. Remove Duplicates from Sorted Array
摘要:问题描述: Given a sorted array, remove the duplicates in-place such that each element appear only once and return the new length. Do not allocate extra sp 阅读全文
posted @ 2017-12-05 10:51 gtxvs 阅读(150) 评论(0) 推荐(0)
leetcode 66. Plus One
摘要:问题描述: Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume the integer do not contain any 阅读全文
posted @ 2017-12-05 10:29 gtxvs 阅读(182) 评论(0) 推荐(0)