自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(25)
  • 资源 (4)
  • 收藏
  • 关注

原创 【LeetCode】645. Set Mismatch

The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another number in the set, which results in repetition of on

2017-08-30 00:39:12 504

原创 【LeetCode】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 a node in s and all of this node’

2017-08-29 23:12:15 205

原创 【LeetCode】594. Longest Harmonious Subsequence

We define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1.Now, given an integer array, you need to find the length of its longest harmon

2017-08-29 22:15:22 227

原创 【LeetCode】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.Note:All letters in hexadecimal (a-f) must be in lowercase. The hexadecimal str

2017-08-29 16:42:09 222

原创 【LeetCode】415. Add Strings

Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2.Note:The length of both num1 and num2 is < 5100. Both num1 and num2 contains only digits 0-9. Both

2017-08-29 16:27:08 214

原创 【LeetCode】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 in a tree. This path may or may no

2017-08-29 16:01:52 212

原创 【LeetCode】 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 characters left, reverse all of them.

2017-08-29 15:17:35 194

原创 【LeetCode】 504. Base 7

Given an integer, return its base 7 string representation.Example 1: Input: 100 Output: “202” Example 2: Input: -7 Output: “-10”题目就是转换为7进制的数字。class Solution {public: string convertToBase7(int

2017-08-29 14:13:13 234

原创 【LeetCode】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 least significant bit on th

2017-08-28 16:30:42 181

原创 全排列算法以及求下一组全排列

1.全排列的算法,考虑相同的数字情况,在递归时需要判断,递归的区间有没有重复的数字。bool isNeedSwap(int *a,int l,int r){ //查找在[l,r)区间中,有没有和a[r]相同的数字 for(int i=l;i<r;i++){ if(a[i]==a[r]){ return false; } }

2017-08-28 14:59:56 968

原创 【LeetCode】628. Maximum Product of Three Numbers

Given an integer array, find three numbers whose product is maximum and output the maximum product.Example 1: Input: [1,2,3] Output: 6 Example 2: Input: [1,2,3,4] Output: 24题目是求三个数的最大乘积。 如果直接暴力是O

2017-08-27 22:49:56 190

原创 【LeetCode】

Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.This is case sensitive, for example “Aa” is not consider

2017-08-27 16:03:45 170

原创 【LeetCode】506. Relative Ranks

Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: “Gold Medal”, “Silver Medal” and “Bronze Medal”.Example 1: Input: [5

2017-08-27 10:44:06 232

原创 【LeetCode】563. Binary Tree Tilt

Given a binary tree, return the tilt of the whole tree.The tilt of a tree node is defined as the absolute difference between the sum of all left subtree node values and the sum of all right subtree nod

2017-08-25 16:39:38 171

原创 【LeetCode】404. Sum of Left Leaves

Find the sum of all left leaves in a given binary tree.Example: 3 / \ 9 20 / \ 15 7There are two left leaves in the binary tree, with values 9 and 15 respectively. Return 24.

2017-08-25 15:41:25 207

原创 【LeetCode】167. Two Sum II - Input array is sorted

Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers suc

2017-08-25 14:07:27 152

原创 【LeetCode】 82. Remove Duplicates from Sorted List II

iven a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example, Given 1->2->3->3->4->4->5, return 1->2->5. Given 1->1->1->2-

2017-08-24 17:19:51 161

原创 【LeetCode】599. Minimum Index Sum of Two Lists

Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings. You need to help them find out their common interest with the l

2017-08-23 16:54:06 319

原创 【LeetCode】349. Intersection of Two Arrays

Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Note:Each element in the result must be unique.The result can be in a

2017-08-23 16:14:25 132

原创 【LeetCode】661. Image Smoother

Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the average gray scale (rounding down) of all the 8 surrou

2017-08-23 15:39:53 1703

原创 【LeetCode】538. Convert BST to Greater Tree

Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys greater than the original key in BST.Example:

2017-08-23 14:34:04 188

原创 【LeetCode】Add to List 606. Construct String from Binary Tree

You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way.The null node needs to be represented by empty parenthesis pair “()”. And you nee

2017-08-23 11:03:11 180

原创 【LeetCode】653. Two Sum IV - Input is a BST

Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target.Example 1:Input: 5 / \ 3 6 / \ \2

2017-08-22 19:06:33 226

原创 【LeetCode】Add to List 637. Average of Levels in Binary Tree

Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array.Example 1:Input: 3 / \ 9 20 / \ 15 7Output: [3, 14.5, 11]Explanation:T

2017-08-22 15:41:00 282

原创 C++实现删除某个文件夹的文件

最近做项目的时候,希望程序在运行前,删除某个文件夹的缓存文件。手动删除太麻烦,希望用脚本实现,于是写了下面的代码.int DeleteAllFile(char *to_search) { long handle; //用于查找的句柄; struct _finddata_t file

2017-08-10 15:46:43 8925

SQL基础教程

非常好的一个SQL基础教程,我自己看了 觉得比较有用

2014-09-18

组成原理课程设计

重点院校的计算机组成原理课程设计报告,比较详细

2014-09-18

C语言经典小程序

上百个C语言的经典题和代码,十分适合初学C语言的同学

2011-12-07

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除