摘要: 题目描述 二哥当了多年的助教,今天终于要发工资了!二哥正在高兴之际,得知工资是分两部分发放的。第一部分是这学期的工资,另一部分是之前所有学期的工资总和。而领取工资时,出纳员会问二哥,两部分工资加在一起是多少,如果二哥回答错了,就只能领到这个学期的工资之前所有学期的劳动就白费了。 二哥从小道消息得知, 阅读全文
posted @ 2017-11-03 10:10 bernieloveslife 阅读(188) 评论(0) 推荐(0) 编辑
摘要: Description 作为所有 Online Judge 的传统题目,你只需读两个整数,输出即可,保证输入的数绝对值不超过1000。 Input Format 一行,两个空格隔开的整数A,B。 Output Format 一个数A+B。 Sample Input Sample Output 阅读全文
posted @ 2017-11-03 10:09 bernieloveslife 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 题目描述 二哥平日喜欢自己种一些东西,并以此为写程序和看电影之外的最大爱好。最近,二哥种的一棵苹果树到了采摘的时候,但是由于二哥身高的限制,有些苹果太高摘不到。于是二哥借来了一个凳子,踩在上面可以摘到更多的苹果。 二哥是一个懒于行动的人,他想在摘苹果之前知道自己能摘到多少苹果,如果实在太少(苹果树很 阅读全文
posted @ 2017-11-03 10:09 bernieloveslife 阅读(402) 评论(0) 推荐(0) 编辑
摘要: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space fo 阅读全文
posted @ 2017-10-27 21:13 bernieloveslife 阅读(144) 评论(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 @ 2017-10-27 14:50 bernieloveslife 阅读(110) 评论(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 @ 2017-10-27 14:46 bernieloveslife 阅读(121) 评论(0) 推荐(0) 编辑
摘要: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Given nums = [0, 1, 阅读全文
posted @ 2017-10-27 14:26 bernieloveslife 阅读(107) 评论(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-10-27 14:18 bernieloveslife 阅读(110) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexi 阅读全文
posted @ 2017-10-27 14:03 bernieloveslife 阅读(139) 评论(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-10-27 13:35 bernieloveslife 阅读(118) 评论(0) 推荐(0) 编辑