2018年3月9日

LeetCode 260 Single Number III 数组中除了两个数外,其他的数都出现了两次,找出这两个只出现一次的数

摘要: Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements 阅读全文

posted @ 2018-03-09 22:45 lina2014 阅读(152) 评论(0) 推荐(0) 编辑

LeetCode 137 Single Number II 数组中除了一个数外,其他的数都出现了三次,找出这个只出现一次的数

摘要: Given an array of integers, every element appears three times except for one, which appears exactly once. Find that single one.Note:Your algorithm sho 阅读全文

posted @ 2018-03-09 22:40 lina2014 阅读(142) 评论(0) 推荐(0) 编辑

LeetCode 136 Single Number 数组中除一个数外其他数都出现两次,找出只出现一次的数

摘要: Given an array of integers, every element appears twice except for one. Find that single one. 阅读全文

posted @ 2018-03-09 22:18 lina2014 阅读(94) 评论(0) 推荐(0) 编辑

LeetCode 179 Largest Number 把数组排成最大的数

摘要: Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed nu 阅读全文

posted @ 2018-03-09 20:32 lina2014 阅读(135) 评论(0) 推荐(0) 编辑

LeetCode 225 Implement Stack using Queues 用队列实现栈

摘要: 1、两个队列实现,始终保持一个队列为空即可 2、一个队列实现栈 阅读全文

posted @ 2018-03-09 16:49 lina2014 阅读(116) 评论(0) 推荐(0) 编辑

LeetCode 232 Implement Queue using Stacks 两个栈实现队列

摘要: 1 class MyQueue { 2 public: 3 /** Initialize your data structure here. */ 4 MyQueue() { 5 6 } 7 8 /** Push element x to the back of queue. */ 9 void push(in... 阅读全文

posted @ 2018-03-09 16:24 lina2014 阅读(126) 评论(0) 推荐(0) 编辑

LeetCode 583 Delete Operation for Two Strings 删除两个字符串的不同部分使两个字符串相同,求删除的步数

摘要: Given two words word1 and word2, find the minimum number of steps required to make word1 and word2 the same, where in each step you can delete one cha 阅读全文

posted @ 2018-03-09 14:07 lina2014 阅读(125) 评论(0) 推荐(0) 编辑

LeetCode 230 Kth Smallest Element in a BST 二叉搜索树中的第K个元素

摘要: 1、非递归解法 2、递归解法 阅读全文

posted @ 2018-03-09 12:00 lina2014 阅读(109) 评论(0) 推荐(0) 编辑

LeetCode 236 Lowest Common Ancestor of a Binary Tree 二叉树两个子节点的最低公共父节点

摘要: 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(int x) : val(x), left(NULL), right(N... 阅读全文

posted @ 2018-03-09 10:49 lina2014 阅读(104) 评论(0) 推荐(0) 编辑

导航