This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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()){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "stdio.h" | |
| int main(){ | |
| int a = 2; | |
| int b = 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 0x0000000000400ef9 <+0>: sub $0x18,%rsp | |
| 0x0000000000400efd <+4>: lea 0x8(%rsp),%rcx | |
| 0x0000000000400f02 <+9>: lea 0xc(%rsp),%rdx | |
| 0x0000000000400f07 <+14>: mov $0x401ebe,%esi | |
| 0x0000000000400f0c <+19>: mov $0x0,%eax | |
| 0x0000000000400f11 <+24>: callq 0x400ab0 <__isoc99_sscanf@plt> | |
| 0x0000000000400f16 <+29>: cmp $0x1,%eax | |
| 0x0000000000400f19 <+32>: jg 0x400f20 <phase_3+39> | |
| 0x0000000000400f1b <+34>: callq 0x40163d <explode_bomb> | |
| 0x0000000000400f20 <+39>: cmpl $0x7,0xc(%rsp) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 0x0000000000400fc1 <+0>: sub $0x18,%rsp | |
| 0x0000000000400fc5 <+4>: lea 0xc(%rsp),%rdx | |
| 0x0000000000400fca <+9>: mov $0x401ec1,%esi | |
| 0x0000000000400fcf <+14>: mov $0x0,%eax | |
| 0x0000000000400fd4 <+19>: callq 0x400ab0 <__isoc99_sscanf@plt> | |
| 0x0000000000400fd9 <+24>: cmp $0x1,%eax | |
| 0x0000000000400fdc <+27>: jne 0x400fe5 <phase_4+36> | |
| 0x0000000000400fde <+29>: cmpl $0x0,0xc(%rsp) | |
| 0x0000000000400fe3 <+34>: jg 0x400fea <phase_4+41> | |
| 0x0000000000400fe5 <+36>: callq 0x40163d <explode_bomb> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 0x0000000000400f84 <+0>: mov %rbx,-0x10(%rsp) | |
| 0x0000000000400f89 <+5>: mov %rbp,-0x8(%rsp) | |
| 0x0000000000400f8e <+10>: sub $0x18,%rsp | |
| 0x0000000000400f92 <+14>: mov %edi,%ebx | |
| 0x0000000000400f94 <+16>: mov $0x1,%eax | |
| 0x0000000000400f99 <+21>: cmp $0x1,%edi | |
| 0x0000000000400f9c <+24>: jle 0x400fb2 <func4+46> | |
| 0x0000000000400f9e <+26>: lea -0x1(%rbx),%edi | |
| 0x0000000000400fa1 <+29>: callq 0x400f84 <func4> | |
| 0x0000000000400fa6 <+34>: mov %eax,%ebp |