自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(9)
  • 收藏
  • 关注

原创 LeetCode--292. Nim Game

一,题目  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 stones. The one who removes the last stone will b

2017-01-20 12:47:37 303

原创 LeetCode--448. Find All Numbers Disappeared in an Array

一,题目 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] inclusive that do not appear in this array.

2017-01-20 11:33:18 260

原创 LeetCode--463. Island Perimeter

Codeint islandPerimeter(int** grid, int gridRowSize, int gridColSize) { int nums = 0; for (int i = 0; i < gridRowSize; i++) { for (int j = 0; j < gridColSize; j++) {

2017-01-20 10:31:11 186

原创 LeetCode--344. Reverse String

Codeclass Solution {public: string reverseString(string s) { string str; for (int i = s.length()-1; i>=0; i--) { str += s.at(i); } return str;

2017-01-19 18:48:32 162

原创 LeetCode--412. Fizz Buzz

Codeclass Solution {public: vector<string> fizzBuzz(int n) { vector<string> str; for (int i = 1; i < n+1; i++) { stringstream ss; string s;

2017-01-19 18:30:43 268

原创 LeetCode--485. Max Consecutive Ones

一,题目二,代码class Solution {public: int findMaxConsecutiveOnes(vector<int>& nums) { int length = nums.size(); int sum=0; int tem=0; for (int i = 0; i < length; i++)

2017-01-19 17:57:44 185

原创 LeetCode--476. Number Complement

一,题目截图二,代码#include <iostream>using namespace std;class Solution {public: int findComplement(int num) { int complement = 0; int i = 0; if (num == 0) return 1; i

2017-01-19 16:43:03 218

原创 LeetCode--419. Battleships in a Board

一,题目截图二,编程语言知识回顾–C++ vector   vector(向量): C++中的一种数据结构,确切的说是一个类。它相当于一个动态的数组,当程序员无法知道自己需要的数组的规模多大时,用其来解决问题可以达到最大节约空间的目的。   用法: 1. include       2. using namespace std;   声明: 1. vector a;(等于声明了一个int数组

2017-01-19 15:09:24 304

原创 LeetCode--461. Hamming Distance

LeetCode–461. Hamming Distance一,题目截图二,关于Hamming Distance  在信息论中,两个等长字符串之间的汉明距离是两个字符串对应位置的不同字符的个数。换句话说,它就是将一个字符串变换成另外一个字符串所需要替换的字符个数。汉明重量是字符串相对于同样长度的零字符串的汉明距离,也就是说,它是字符串中非零的元素个数:对于二进制字符串来说,就是 1 的个数,所以 1

2017-01-19 13:33:36 317

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除