- 博客(15)
- 收藏
- 关注
原创 [LeetCode]405. Convert a Number to Hexadecimal(32位有符号整数转化为十六进制)
405. Convert a Number to Hexadecimal原题链接 Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used. 题目大意: 给一个整数,写出它的十六进制,对于负整数,可以用二进制补码
2017-05-31 00:11:47 1955
原创 [LeetCode]415. Add Strings(计算两个字符串表示的数字的和)
415. Add Strings原题链接 Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2. 给定两个用字符串表示的非负整数num1和num2,返回用字符串表示的num1和num2的和。Note:The length of both num1
2017-05-29 21:43:38 2863
原创 [LeetCode]108. Convert Sorted Array to Binary Search Tree(升序数组转化为平衡二叉树)
108. Convert Sorted Array to Binary Search Tree原题链接 Given an array where elements are sorted in ascending order, convert it to a height balanced BST.题目大意: 给定一个升序数组,转化为一个平衡二叉树思路:首先要了解二叉排序树BST的定义。给定一个
2017-05-29 17:32:00 593
原创 [LeetCode]572. Subtree of Another Tree(判断树t是否是树S的子树)
572. Subtree of Another Tree原题链接 Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree consists of
2017-05-28 00:21:38 1088
原创 [LeetCode]543. Diameter of Binary Tree(计算二叉树的直径的长度)
543. Diameter of Binary Tree原题链接 Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes
2017-05-27 23:10:39 667
原创 [LeetCode]541. Reverse String II(间隔反转字符串)
541. Reverse String II原题链接 Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k character
2017-05-23 21:12:49 971
原创 markdown编辑器使用方法
欢迎使用Markdown编辑器写博客本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦:Markdown和扩展Markdown简洁的语法代码块高亮图片链接和图片上传LaTex数学公式UML序列图和流程图离线写博客导入导出Markdown文件丰富的快捷键快捷键加粗 Ctrl + B 斜体 Ctrl + I 引用 Ctrl
2017-05-23 20:46:47 504
原创 [LeetCode]268. Missing Number(求数组中缺失的元素)
268. Missing Number原题链接 Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array. 给定一个包含从0,1,2,…,n中取出的n个不同数字的数组,找到数组中缺少的元素。 For exampleGiven
2017-05-10 11:41:14 481
原创 [LeetCode]447. Number of Boomerangs(求回旋镖数量)
447. Number of Boomerangs原题链接 Given n points in the plane that are all pairwise distinct, a “boomerang” is a tuple of points (i, j, k) such that the distance between i and j equals the distance betwee
2017-05-09 00:01:02 1269
原创 [LeetCode]575. Distribute Candies(妹妹最多能得到多少种糖果)
575. Distribute Candies原题链接 Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of the corresponding kind.
2017-05-07 20:28:36 3955
原创 [LeetCode]551. Student Attendance Record I(根据学生出勤记录判断是否应获奖金)
551. Student Attendance Record I原题链接 You are given a string representing an attendance record for a student. The record only contains the following three characters:‘A’ : Absent.‘L’ : Late.‘P’ : Pr
2017-05-07 00:24:43 585
原创 [LeetCode]350. Intersection of Two Arrays II(求两个数组交集 II)
350. Intersection of Two Arrays II点击查看349. Intersection of Two Arrays原题链接 Given two arrays, write a function to compute their intersection. 给两个数组,写一个函数求交集 Example:Given nums1 = [1, 2, 2, 1], nums2 =
2017-05-05 21:14:09 672
原创 [LeetCode]206. Reverse Linked List(反转单链表)
206. Reverse Linked ListReverse a singly linked list. 反向单链表。 Hint: A linked list can be reversed either iteratively or recursively. Could you implement both? 提示: 可以迭代或递归地颠倒链表思路1:现将链表变成环,每次都将原第一个结
2017-05-04 21:29:45 970
原创 [LeetCode]401. Binary Watch(二进制手表)
401. Binary Watch原题地址 A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59). Each LED represents a zero or one, with the l
2017-05-03 21:23:48 2534
原创 [LeetCode]566. Reshape the Matrix(重塑矩阵)
566. Reshape the MatrixIn MATLAB, there is a very useful function called ‘reshape’, which can reshape a matrix into a new one with different size but keep its original data.You’re given a matrix repres
2017-05-03 00:21:17 1452
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人