摘要: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 阅读全文
posted @ 2017-07-12 12:01 immjc 阅读(102) 评论(0) 推荐(0) 编辑
摘要: Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, giv 阅读全文
posted @ 2017-07-12 11:34 immjc 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 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 rep 阅读全文
posted @ 2017-07-12 11:11 immjc 阅读(149) 评论(0) 推荐(0) 编辑
摘要: Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at 阅读全文
posted @ 2017-07-12 10:33 immjc 阅读(145) 评论(0) 推荐(0) 编辑
摘要: Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 Trivia:This problem was inspired by this original tweet by Max Howell: Go 阅读全文
posted @ 2017-07-11 20:14 immjc 阅读(115) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] 阅读全文
posted @ 2017-07-11 20:01 immjc 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of 阅读全文
posted @ 2017-07-11 10:53 immjc 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l 阅读全文
posted @ 2017-07-11 10:12 immjc 阅读(91) 评论(0) 推荐(0) 编辑
摘要: help: 内建命令的帮助信息 help ls ls --help: 外部命令帮助信息(help为参数) man: 显示系统手册中的内容 info: 显示更完整的GNU工具信息 date: 显示当前系统的时间和日期 cal: 显示当月的日历 df: 查看磁盘驱动器当前的可用空间(容量) du: 查看 阅读全文
posted @ 2017-07-10 22:49 immjc 阅读(434) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2017-07-10 21:44 immjc 阅读(153) 评论(0) 推荐(0) 编辑