Skip to content

Instantly share code, notes, and snippets.

View Cee's full-sized avatar
πŸŽ€
ハネだ (<ゝω·)β˜†

Tianyu Wang Cee

πŸŽ€
ハネだ (<ゝω·)β˜†
View GitHub Profile
@Cee
Cee / read_six_numbers.asm
Created July 26, 2014 06:26
read_six_numbers
0x0000000000401743 <+0>: sub $0x18,%rsp
0x0000000000401747 <+4>: mov %rsi,%rdx
0x000000000040174a <+7>: lea 0x4(%rsi),%rcx
0x000000000040174e <+11>: lea 0x14(%rsi),%rax
0x0000000000401752 <+15>: mov %rax,0x8(%rsp)
0x0000000000401757 <+20>: lea 0x10(%rsi),%rax
0x000000000040175b <+24>: mov %rax,(%rsp)
0x000000000040175f <+28>: lea 0xc(%rsi),%r9
0x0000000000401763 <+32>: lea 0x8(%rsi),%r8
0x0000000000401767 <+36>: mov $0x401eb2,%esi
@Cee
Cee / phase_2.asm
Created July 26, 2014 06:23
phase_2
0x0000000000400e8c <+0>: mov %rbx,-0x20(%rsp)
0x0000000000400e91 <+5>: mov %rbp,-0x18(%rsp)
0x0000000000400e96 <+10>: mov %r12,-0x10(%rsp)
0x0000000000400e9b <+15>: mov %r13,-0x8(%rsp)
0x0000000000400ea0 <+20>: sub $0x48,%rsp
0x0000000000400ea4 <+24>: mov %rsp,%rsi
0x0000000000400ea7 <+27>: callq 0x401743 <read_six_numbers>
0x0000000000400eac <+32>: mov %rsp,%rbp
0x0000000000400eaf <+35>: lea 0xc(%rsp),%r13
0x0000000000400eb4 <+40>: mov $0x0,%r12d
@Cee
Cee / phase_1.asm
Last active August 29, 2015 14:04
phase_1
0x0000000000400e70 <+0>: sub $0x8,%rsp
0x0000000000400e74 <+4>: mov $0x401af8,%esi
0x0000000000400e79 <+9>: callq 0x40123d <strings_not_equal>
0x0000000000400e7e <+14>: test %eax,%eax
0x0000000000400e80 <+16>: je 0x400e87 <phase_1+23>
0x0000000000400e82 <+18>: callq 0x40163d <explode_bomb>
0x0000000000400e87 <+23>: add $0x8,%rsp
0x0000000000400e8b <+27>: retq
@Cee
Cee / Trick.cpp
Created June 19, 2014 05:18
2+2=5
#include "stdio.h"
int main(){
int a = 2;
int b = 2;
public class Solution {
public int uniquePaths(int m, int n) {
long ret = 1;
int a = m - 1, b = n - 1;
if ((a == 0) || (b == 0)) return 1;
if (a > b){
a = a ^ b;
b = a ^ b;
a = a ^ b;
}
public class Solution {
public boolean isValid(String s) {
Stack<Character> stack = new Stack<Character>();
if (s.length() % 2 != 0) return false;
for (int i = 0; i < s.length(); i++){
char c = s.charAt(i);
if ((c == '(') || (c == '[') || (c == '{')){
stack.push(c);
}else{
if (stack.empty()){
public class Solution {
public int maxProfit(int[] prices) {
int ret = 0;
if (prices.length <= 1) return 0;
int min = prices[0];
for (int i = 0; i < prices.length; i++) {
min = Math.min(min, prices[i]);
ret = Math.max(ret, prices[i] - min);
}
return ret;
public class Solution {
public int maxSubArray(int[] A) {
int sum = Integer.MIN_VALUE;
int ret = Integer.MIN_VALUE;
int length = A.length;
for(int i = 0; i < A.length; i++){
if (sum < 0){
sum = A[i];
}else{
sum += A[i];
public class Solution {
public int climbStairs(int n) {
if (n == 0) return 0;
if (n == 1) return 1;
if (n == 2) return 2;
int ret = 0;
int tempa = 2;
int tempb = 1;
for (int i = 3; i <= n; i++){
ret = tempa + tempb;
/**
* Definition for binary tree
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
public class Solution {