Mapoto4

要努力学习啊。

Hexo添加照片流分享

前言心中念念不忘许久的书籍音乐分享功能在近日通过查找资料完成了。 这里做个记录,留下踩坑史。 配置 下载代码,将脚本放到主题目录下scripts目录,如果没有目录则新建目录git clone https://github.com/mapoto4/mapoto4.github.io.git 通过指令新建页面目录 1234567 myblog├── _config.yml├── package......

二分查找的实现

非递归方法12345678910111213public static int rank(int[] a, int key) { int lo = 0; int hi = a.length - 1; while (lo <= hi) { int mid = lo + (hi - lo) / 2; if(key &......

LeetCode-Letter Combinations of a Phone Number

题目Letter Combinations of a Phone Number 解题思路1.建立映射表,对号码进行深度优先搜索。2.找出对应的字母3.StringBulider构建临时字符串 代码123456789101112131415161718192021222324List<String> res;public List<String> letterCombi......

我不知道的这一年

一“各位旅客朋友大家好,本次列车是G276次列车,由广州南开往青岛。” 这是2017年1月1日6点36分,我正坐在开往徐州的火车上,和往年一样在火车站渡过一个寒冷的夜晚,早晨六点开始检票进站,每次都在熟悉的地方解决一顿回家前的早餐。 ...

LeetCode-Zigzag Conversion

题目The string PAYPALISHIRING is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) 123P A H NA P L S ......

LeetCode-Rotate Image

问题You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). 解题思路此题是将一个二维正方矩阵数组旋转90度。如下变换所示,最外层数组旋转方式。1234[ 5, 1, 9,11] [15, 1, 9, 5] [15,13, 9, 5] ......

LeetCode-Palindrome Number

题目Determine whether an integer is a palindrome. Do this without extra space. 解题思路将输入的整数倒序输出,判断是否和输入的整数相等。 代码1234567891011121314151617181920public boolean isPalindrome(int x) { if (x >= 2147......

LeetCode-Container With Most Water

题目Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find t......

LeetCode-Group Anagrams

题目Given an array of strings, group anagrams together. For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:12345[ [&q......

LeetCode-Pow(x, n)

题目Implement pow(x, n). 解题思路首先考虑所有的特殊情况:分母为零,分子为零,分子为负数 通过分治法,将n = n / 2划分,直到n=1 如果n % 2 == 0则x ^ n = ( x * x ) ^ ( n / 2 )否则x ^ n = x * ( x * x ) ^ ( n / 2 ) 代码1234567891011121314151617181920publi......