Skip to content

Instantly share code, notes, and snippets.

View songouyang's full-sized avatar
🎯
Focusing

songouyang

🎯
Focusing
View GitHub Profile
@songouyang
songouyang / Template.py
Last active November 17, 2017 09:27
[Pycharm中Python模板] pycharm模板 #Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : ${YEAR}/${MONTH}/${DAY}
# @Author : ouyangsong
# @Contact : songouyang@live.com
# @File : ${NAME}.py
if __name__ == "__main__":
pass
@songouyang
songouyang / .vimrc
Last active November 23, 2017 04:30
.vimrc
"vundle
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'wakatime/vim-wakatime'
Plugin 'scrooloose/syntastic'
call vundle#end()
filetype plugin indent on " enables filetype detection
@songouyang
songouyang / 120.cpp
Last active November 18, 2017 06:15
120. Triangle
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int minimumTotal(vector<vector<int>>& triangle) {
if (triangle.empty()){
return 0;
}
@songouyang
songouyang / 53.cpp
Created November 18, 2017 07:50
53. Maximum Subarray
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int maxSubArray(vector<int> &nums) {
int local_max = nums[0];
int global_max = nums[0];
@songouyang
songouyang / .bash_profile
Created November 19, 2017 13:04
bash配置
# export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
export HOMEBREW_BOTTLE_DOMAIN=http://7xkcej.dl1.z0.glb.clouddn.com
export PATH=/usr/local/texlive/2017basic/bin/x86_64-darwin:$PATH
alias ls="ls -G"
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias ll='ls -lG'
alias grep='grep -i --color'
@songouyang
songouyang / .npmrc
Created November 19, 2017 13:05
npm配置
registry = https://registry.npm.taobao.org
@songouyang
songouyang / .condarc
Created November 19, 2017 13:05
conda配置
channels:
- conda-forge
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults
show_channel_urls: true
@songouyang
songouyang / 132.cpp
Last active November 29, 2017 14:43
132. Palindrome Partitioning II
class Solution {
public:
int minCut(string s) {
unsigned long t = s.size();
vector<vector<bool>> p(t, vector<bool>(t, false));
vector<int> dp(t, INT_MAX);
for (int i = 0; i < t; ++i) {
for (int j = i; j >= 0; --j) {
if ((i - j <= 1 || p[j + 1][i - 1]) && s[i] == s[j]) {
p[j][i] = true;
@songouyang
songouyang / 84.cpp
Created December 2, 2017 08:44
84. Largest Rectangle in Histogram
class Solution {
public:
int largestRectangleArea(vector<int> &heights) {
stack<int> s;
int max_size = 0;
heights.push_back(-1);
for (int i = 0; i < heights.size(); ++i) {
while (!s.empty() and heights[i] < heights[s.top()]) {
int tmp = s.top();
int h = heights[tmp];
@songouyang
songouyang / .vimrc
Created January 8, 2018 07:53
vimrc
"Don't put any lines in your vimrc that you don't understand.
syntax on "语法高亮显示。
set encoding=utf-8 "utf-8编码
set hlsearch "高亮度反白
set backspace=2 "可以用Backspace键删除
set ts=4 "tab键等于4个空格
set expandtab "tab键自动变空格
set autoindent "自动缩进
set smartindent "比autoindent稍智能的自动缩进
set pastetoggle=<F9> "插入模式粘贴按F9取消自动缩进