小凉

3 0642700 3 0642770 5 34202 13942 4314 0624

随笔分类 -  algorithm

Number of 1 Bits(Difficulty: Easy)
摘要:题目: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 32- 阅读全文

posted @ 2016-05-12 18:20 小凉 阅读(148) 评论(0) 推荐(0) 编辑

Longest Substring Without Repeating Characters(Difficulty: Medium)
摘要:题目: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the 阅读全文

posted @ 2016-05-10 20:36 小凉 阅读(127) 评论(0) 推荐(0) 编辑

Counting Bits(Difficulty: Medium)
摘要:题目: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation a 阅读全文

posted @ 2016-05-09 17:30 小凉 阅读(127) 评论(0) 推荐(0) 编辑

Power of Four(Difficulty: Easy)
摘要:题目: Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example:Given num = 16, return true. Given num = 5, retur 阅读全文

posted @ 2016-05-06 17:40 小凉 阅读(204) 评论(0) 推荐(0) 编辑

Integer Break(Difficulty: Easy)
摘要:题目: Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum 阅读全文

posted @ 2016-05-05 18:18 小凉 阅读(174) 评论(0) 推荐(0) 编辑

字符串旋转
摘要:题目:Reverse String (难度一颗星) Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh". 实现: 阅读全文

posted @ 2016-05-05 16:33 小凉 阅读(194) 评论(0) 推荐(0) 编辑

我们都遇到过的 Replace Blank Space
摘要:题目描述: 请实现一个函数,将一个字符串中的空格替换成“%20”。例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。 分析: 看到这个题目,我们都会有一个比较直观的加法,那就是遍历字符串,每当遇到空格,就在当前位置插入“%20”,当前位置的字符往后移 阅读全文

posted @ 2016-03-11 21:11 小凉 阅读(548) 评论(0) 推荐(0) 编辑

简单的两数之和再次乱入<< Add Two Numbers >>
摘要:请看题目描述: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a 阅读全文

posted @ 2016-03-11 16:16 小凉 阅读(795) 评论(0) 推荐(0) 编辑

一个非常简单的算法题是否愿意挑战一下呢
摘要:求两个数之和。这个问题够简单吧!能做对绝对不是问题,问题是你是否能做的比较好。好了,请看题目: Given an array of integers, return indices of the two numbers such that they add up to a specific targ 阅读全文

posted @ 2016-03-10 22:37 小凉 阅读(1496) 评论(14) 推荐(0) 编辑

导航

统计

点击右上角即可分享
微信分享提示