摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 题意:将已排序的数组转成高度平衡的搜索二叉树。 思路:这题和Convert sorted list to 阅读全文
posted @ 2017-06-29 20:49 王大咩的图书馆 阅读(165) 评论(0) 推荐(0) 编辑
摘要: Say you have an array for which the i th element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may compl 阅读全文
posted @ 2017-06-29 20:36 王大咩的图书馆 阅读(330) 评论(0) 推荐(0) 编辑
摘要: Say you have an array for which the i th element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may compl 阅读全文
posted @ 2017-06-29 16:54 王大咩的图书馆 阅读(259) 评论(0) 推荐(0) 编辑
摘要: Say you have an array for which the i th element is the price of a given stock on day i. If you were only permitted to complete at most one transactio 阅读全文
posted @ 2017-06-29 16:05 王大咩的图书馆 阅读(208) 评论(0) 推荐(0) 编辑
摘要: Given a 2D board containing'X'and'O', capture all regions surrounded by'X'. A region is captured by flipping all'O's into'X's in that surrounded regio 阅读全文
posted @ 2017-06-29 15:00 王大咩的图书馆 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 本文为对《C++ primer (中文版第五版)》中有关关联容器的讲解和网上大神们的博客整理而成。 关联容器和顺序容器的根本不同在于:关联容器中的元素是按关键字来保存和访问的,而顺序容器中的元素则是按它们在容器中的位置来顺序保存和访问的。顺序容器有vector、deque、list、forward_ 阅读全文
posted @ 2017-06-29 01:24 王大咩的图书馆 阅读(4120) 评论(0) 推荐(2) 编辑
摘要: Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example,Given[100, 4, 200, 1, 3, 2],The longest 阅读全文
posted @ 2017-06-28 16:52 王大咩的图书馆 阅读(562) 评论(0) 推荐(0) 编辑
摘要: Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. For exampl 阅读全文
posted @ 2017-06-28 00:55 王大咩的图书馆 阅读(495) 评论(1) 推荐(0) 编辑
摘要: Given two binary strings, return their sum (also a binary string). For example,a ="11"b ="1"Return"100". 题意:将两个以字符串形式保存的二进制数进行相加。 思路:其实不管是以数组、字符串形式,加或 阅读全文
posted @ 2017-06-27 17:56 王大咩的图书馆 阅读(476) 评论(0) 推荐(1) 编辑
摘要: Validate if a given string is numeric. Some examples:"0"=>true" 0.1 "=>true"abc"=>false"1 a"=>false"2e10"=>true Note: It is intended for the problem s 阅读全文
posted @ 2017-06-27 16:51 王大咩的图书馆 阅读(264) 评论(0) 推荐(0) 编辑
摘要: Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified. You shou 阅读全文
posted @ 2017-06-27 15:03 王大咩的图书馆 阅读(190) 评论(0) 推荐(0) 编辑
摘要: Given an absolute path for a file (Unix-style), simplify it. For example,path ="/home/", =>"/home"path ="/a/./b/../../c/", =>"/c" click to show corner 阅读全文
posted @ 2017-06-27 00:43 王大咩的图书馆 阅读(333) 评论(0) 推荐(0) 编辑
摘要: Implement wildcard pattern matching with support for'?'and'*'. 这题和正则表达式匹配有点类似,' . '和本题中的' ? '一样,区别在于' * ',在正则表达式那题中,' * '可以表示之前字符的0个或多个;本题中,可以表示任意字符串。 阅读全文
posted @ 2017-06-26 13:12 王大咩的图书馆 阅读(330) 评论(0) 推荐(1) 编辑
摘要: 本文章来自实验楼的操作过程和其中相应地解释。(博客园不知道怎么回事,上传图片总是失败。) 一、对数据库修改 1)删除数据库的命令为:DROP DATABASE 数据名; 二、对表的修改 1)重命名一张表的语句,可以采取多种方式,以下3种格式的效果一样: i)RENAME TABLE 原名 TO 新名 阅读全文
posted @ 2017-06-26 00:15 王大咩的图书馆 阅读(709) 评论(0) 推荐(0) 编辑
摘要: Given an array of strings, return all groups of strings that are anagrams. Note: All inputs will be in lower-case. 题意:anagrams的意思是回文构词法。回文构词法有一个特点:单词里 阅读全文
posted @ 2017-06-25 21:54 王大咩的图书馆 阅读(343) 评论(0) 推荐(0) 编辑