240 发简信
IP属地:佛罗里达州
  • Letter Combinations of a Phone Number

    //本题用dfs的思路解题; class Solution { public ListletterCombinations(String digits) { ...

  • 3Sum Closest

    /* 1 遍历整个数组 2 起始点和结束点 从前后往中间遍历 3 比较和与target的差值 小的存入结果当中 注意 ans 初始值不能付最大 ; */ class Solu...

  • 3Sum

    /*dfs 算法 时间超时 class Solution { public List> threeSum(int[] nums) { List> resu...

  • Longest Common Prefix

    /* 两层for循环 "dog","racecar","car" 第一层循环第一个数的长度用于增加长度 第二个循环 遍历每个数组的相同位置用于比较是否是相同; 失败 结果不对...

  • romanToInt

    /* (有缺陷 最好是从后往前) 建立一个map储存映射关系 可以用swith; 思路是 从前到后遍历 前面的数大于后面的数 吧前面的数加到结果里,反之相减加入结果; */ ...

  • intToRoman

    /* q = x / 1000; x = x % 1000; for q->m; wb = x / 500; x = x % 500; 判断 wb 是否等于 9;for wb...

  • Container With Most Water

    /* 失败 超时o(n^2) 的时间复杂度; 两层for循环 遍历数组 heigh小的 * x轴的差值 大的数储存在ans中; class Solution { publ...

  • Palindrome Number

    /* 注意 需要一个int值先获取x的值; 这样不会改变x的值 方便之后做比较; 判断x如果为- 直接return false; 把x取反 与原来比较; */ class S...

  • String to Integer (atoi)

    /* 判定是否为空 trim 后是否长度为0 开始字符如果不是数字或者符号 return 0; sign = 1; 如果开始为‘-’ sign = -1; start + 1...

  • String to Integer (atoi)失败

    /* Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index o...

  • Reverse Integer

    /* while循环 一直到x = 0; 拆分: temp = modint; modint = int % 10; int = int / 10; 合并 mo...

  • Reverse Integer失败

    失败 没办法在string builder 转成int的时候判断是否越界 /* 注意:判断是否越界; 1将int 转成字符串; 2判断第一位是否是符号 是符号保留; 3建立s...

  • ZigZag Conversion

    /* Input: s = "PAYPALISHIRING", numRows = 4 Output: "PINALSIGYAHRPI" 注意:一定判断numrows 长度 ...

  • Longest Palindromic Substring

    Given a strings, find the longest palindromic substring ins. You may assume that the ma...

  • Add Two Numbers

    You are given twonon-emptylinked lists representing two non-negative integers. The digi...

  • Longest Substring Without Repeating Characters

    Given a string, find the length of thelongest substringwithout repeating characters. Ex...