算法题目
文章平均质量分 60
只如初见wmj
精彩人生!
展开
-
leetcode(c++) Isomorphic Strings
leetcode 题目练习Isomorphic Strings 题目要求:Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to gett.All原创 2015-04-29 21:48:01 · 468 阅读 · 0 评论 -
(leetcode) Reverse Integer
题目Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321 C++实现class Solution {public: int reverse(int x) { double result = 0; whil原创 2015-05-08 21:03:30 · 262 阅读 · 0 评论 -
Remove Linked List Elements
leetcode题目Remove Linked List ElementsRemove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --原创 2015-05-03 16:29:19 · 277 阅读 · 0 评论 -
正整数n内包含质数(素数)的个数
leetcode题目 质数问题Description:Count the number of prime numbers less than a non-negative number, n解决方案:class Solution {public: int countPrimes(int n) { bool *p=new bool[n];原创 2015-05-01 16:44:38 · 1243 阅读 · 0 评论 -
(leetcode)Rotate Array
题目:Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to[5,6,7,1,2,3,4]. 将包含七个元素的数组向右移动k位。 C++一种解决方法:class Sol原创 2015-05-16 15:17:01 · 296 阅读 · 0 评论 -
(leetcode)Missing Number
Missing Number 题目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, 3] return 2. 解决方案:原创 2015-09-25 17:22:47 · 251 阅读 · 0 评论