摘要:Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.
        
阅读全文
 
        
            
            
摘要:1 public class Solution { 2 public boolean isPalindrome(String s) { 3 char[] str = s.toCharArray(); 4 if(str.length == 0) 5 return true; 6 for(int i =
        
阅读全文
 
        
            
            
摘要:1.开始采用数组,双重for循环,毫无意外地超时了 class Solution { public: int bulbSwitch(int n) { if(n <= 0) return 0; int *b = new int[n]; for(int i = 0; i < n; ++i) b[i] =
        
阅读全文
 
        
            
            
摘要:递归版本: class Solution {public: bool isPowerOfThree(int n) { if(n <= 0) return false; if(n == 1) return true; else if(n%3 == 0) isPowerOfThree(n/3); els
        
阅读全文