Coding Rabbit


  • 首页

  • 关于

  • 归档

  • 标签

  • 搜索

Contains Duplicate

发表于 2016-08-27
LeetcodeContains DuplicateQuestion 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 array, and it should return false if every element is distinct. Analysis 利用hash表,将数组中的元素逐个插入hash表中,当遇到第一个重复不可插入的时候返回fa ...
阅读全文 »

Excel Sheet Column Number

发表于 2016-08-24
Question Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1B -> 2C -> 3…Z -> 26AA -> 27AB -> 28 Analysis26进制转换为10进制,秦九韶算法? Code1234567891011121314class Solution {public: int titleToNumber(string s) { in ...
阅读全文 »

Github .gitignore 配置

发表于 2016-08-22
Gitignore​ 在代码管理的过程中,常常会有一部分代码是不希望被push到远端的github的,它们可能是临时文件、配置文件,或者像是Jekyll中出现的_site文件夹中的生成文件一样。而将他们都在commit之前记录在.gitignore中就可以成功地避免将它们push到远端Git上了。 .gitignore的创建​ 在mac OSX下在相应的repo文件下 touch .gitignore 即可创建相应文件,而通过vim .gitignore即可对其进行编辑。 .gitignore内容规则 gitignore分为两种模式,分别为开放模式与保守模式,其中开放模式是记录不希 ...
阅读全文 »

Github Pages+Jekyll搭建博客注意事项

发表于 2016-08-20
不管怎么样也终于有个大概的样子了,虽然在不懂CSS HTML 等知识的情况下改模板简直难得哭晕在厕所,但总算也是有了雏形,希望在日后能够尽快地提高码力,写出自己真正喜欢的模板。 ​ 在整个搭建过程中,参考了好多个教程,但是还是碰到了一些旧版教程中无法解决的问题。 RubyGems镜像​ 大部分教程中的淘宝镜像现在已经不好用了,但是RubyChina更新了新的镜像RubyGems镜像 响应式设计​ “响应式设计(Responsive Design)”是一种让网站针对不同的浏览器和设备“响应”不同显示效果的策略,这样可以让网站在任何情况下显示的很棒! ​ 媒体查询是做此 ...
阅读全文 »

Maximum Square || Maximum Rectangle

发表于 2016-01-04
Maximal SquareQuestionGiven a 2D binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area. For example, given the following matrix: 12341 0 1 0 01 0 **1 1** 11 1 **1 1** 11 0 0 1 0 Return 4. Analysis LeetCode Discuss 定义dp数组的维数(m+1)*(n+1)可以控制边界问题 dp[i][ ...
阅读全文 »

Scramble String/ Distinct Subsequences

发表于 2016-01-04
Scramble StringQuestionGiven a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representation of s1 = "great": 1234567 great / \ gr eat / \ / \g r e at / \ a t To scr ...
阅读全文 »

Convert Sorted LinkedList(or Array) to BST

发表于 2016-01-02
Convert Sorted Array to Binary Search TreeQuestionGiven an array where elements are sorted in ascending order, convert it to a height balanced BST. Analysis这题需要将一个排好序的链表转成一个平衡二叉树,我们知道,对于一个二叉树来说,左子树一定小于根节点,而右子树大于根节点。所以我们需要找到链表的中间节点,这个就是根节点,链表的左半部分就是左子树,而右半部分则是右子树,我们继续递归处理相应的左右部分,就能够构造出对应的二叉树了。 故每次只需要 ...
阅读全文 »
1…78
Coding Rabbit

Coding Rabbit

77 日志
37 标签
RSS
Github Facebook weibo
Links
  • Codeboy
  • Yijia_Jin
© 2017 Coding Rabbit
由 Hexo 强力驱动
主题 - NexT.Mist