You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
publicclassSolution{ publicintlengthOfLongestSubstring(String s){ int[] chars = newint[256]; int res = 0; for (char c : s.toCharArray()) { chars[c] = 1; } int num = 0; for (int i = 0; i < 256; i++) { if (chars[i] != 0) num++; }
for (int i = 0; i < s.length(); i++) { String ss; if (i > s.length() - num) {//不重复子串小于num且在s末尾 ss = s.substring(i); } else { ss = s.substring(i, i + num); } int t = len(ss); res = t > res ? t : res; } return res; } publicintlen(String s){//从左开始判断最长不重复子串长度 int[] cs = newint[256]; int lens = 0; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (cs[c] == 1) return lens; else cs[c] = 1; lens++; } return lens; } }