导航

03 2016 档案

摘要:// 10.3.2.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include #include #include #include using namespace std; string & make_plural(int cnt, string &str) { str=cnt > 1 ? (str + "s") : str; ... 阅读全文

posted @ 2016-03-31 22:01 CSU蛋李 阅读(103) 评论(0) 推荐(0)

摘要:LeetCode Count Primes C++ 阅读全文

posted @ 2016-03-31 02:35 CSU蛋李 阅读(190) 评论(0) 推荐(0)

摘要:Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrenc 阅读全文

posted @ 2016-03-31 01:34 CSU蛋李 阅读(104) 评论(0) 推荐(0)

摘要:Reverse a singly linked list. 题目:翻转一个单向链表 很简单,不过要注意设置两个辅助指针变量 阅读全文

posted @ 2016-03-31 01:05 CSU蛋李 阅读(109) 评论(0) 推荐(0)

摘要:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr 阅读全文

posted @ 2016-03-31 00:58 CSU蛋李 阅读(108) 评论(0) 推荐(0)

摘要:Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the 阅读全文

posted @ 2016-03-31 00:49 CSU蛋李 阅读(157) 评论(0) 推荐(0)

摘要:如果一个字母延伸到中线之上,如d或f,则称其有上出头部分。如果一个字母延伸到中线之下,如p或g, 则称其有下出头部分。编写程序,读入一个单词,输出最长的即不包含上出头部分,也不包含下出头部分单 词。 // 9_49.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"# 阅读全文

posted @ 2016-03-30 18:21 CSU蛋李 阅读(268) 评论(0) 推荐(0)

摘要:Each rectangle is defined by its bottom left corner and top right corner as shown in the figure. Assume that the total area is never beyond the maximu 阅读全文

posted @ 2016-03-30 01:49 CSU蛋李 阅读(131) 评论(0) 推荐(0)

摘要:Implement the following operations of a stack using queues. push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack. to 阅读全文

posted @ 2016-03-30 00:43 CSU蛋李 阅读(137) 评论(0) 推荐(0)

摘要:Invert a binary tree. to Trivia:This problem was inspired by this original tweet by Max Howell: 这个题目只要实现一个递归调用即可 阅读全文

posted @ 2016-03-29 10:59 CSU蛋李 阅读(120) 评论(0) 推荐(0)

摘要:Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue. pop() -- Removes the element from in front 阅读全文

posted @ 2016-03-29 01:52 CSU蛋李 阅读(128) 评论(0) 推荐(0)

摘要:Given a singly linked list, determine if it is a palindrome. Follow up:Could you do it in O(n) time and O(1) space? 像1->2->1,1->2->2->1,1,NULL这种都是回文链表 阅读全文

posted @ 2016-03-29 01:17 CSU蛋李 阅读(158) 评论(0) 推荐(0)

摘要:Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia 阅读全文

posted @ 2016-03-28 01:53 CSU蛋李 阅读(202) 评论(0) 推荐(0)

摘要:Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 3 - 阅读全文

posted @ 2016-03-28 00:51 CSU蛋李 阅读(169) 评论(0) 推荐(0)

摘要:Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = "anagram", t = "nagaram", return true.s = "rat", t = 阅读全文

posted @ 2016-03-27 02:26 CSU蛋李 阅读(111) 评论(0) 推荐(0)

摘要:Given an integer, write a function to determine if it is a power of three. Follow up:Could you do it without using any loop / recursion? 最大的int 型3的幂是1 阅读全文

posted @ 2016-03-27 02:15 CSU蛋李 阅读(138) 评论(0) 推荐(0)

摘要:You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 ston 阅读全文

posted @ 2016-03-27 02:11 CSU蛋李 阅读(125) 评论(0) 推荐(0)

摘要:Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For exa 阅读全文

posted @ 2016-03-27 01:49 CSU蛋李 阅读(111) 评论(0) 推荐(0)

摘要:C++,LeetCode,binaryTreePaths 阅读全文

posted @ 2016-03-27 01:43 CSU蛋李 阅读(132) 评论(0) 推荐(0)

摘要:Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a lette 阅读全文

posted @ 2016-03-23 21:14 CSU蛋李 阅读(198) 评论(0) 推荐(0)

摘要:LeetCode Bulls and Cows,getHint,C++ 阅读全文

posted @ 2016-03-23 16:26 CSU蛋李 阅读(162) 评论(0) 推荐(0)

摘要:Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the 阅读全文

posted @ 2016-03-21 22:43 CSU蛋李 阅读(124) 评论(0) 推荐(0)

摘要:Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have ex 阅读全文

posted @ 2016-03-21 22:30 CSU蛋李 阅读(198) 评论(0) 推荐(0)