class Solution {public static boolean decide(char[] data1,int i,int j) {

遇到的问题:

I:查找,i,i+1;
II:验证从i+1到j和j个元素是否相等,这个过程很难直接写出来。
III:两个if-else在一起的时候,外面的else忘了
IV:字符串为空的时候没有考虑到

class Solution {public static boolean decide(char[] data1,int i,int j) {for(int k=i+1;k<j;k++) {if (data1[k]==data1[j]) return false;}return true;}public int lengthOfLongestSubstring(String s) {if(s.length()==0) return 0;else{char[] data9=s.toCharArray();int result=0;for(int i=0;i<s.length();i++) {int k=1;for(int j=i+1;j<s.length();j++) {//这个是要验证j这个元素和前面的所有的都不一样,那么才能够接纳到下一个if(s.charAt(i)!=s.charAt(j)) {if(decide(data9,i,j)) {k++;}else break;}else break;}if(result<k) result=k;    }return result;    }}
}

Longest Substring Without Repeating Characters相关推荐

  1. LeetCode.3-最长无重复字符子串(Longest Substring Without Repeating Characters)

    这是悦乐书的第341次更新,第365篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Medium级别的第2题Longest Substring Without Repeating Cha ...

  2. 3.longest substring without repeating characters

    Given a string, find the length of the longest substring without repeating characters. Example 1: In ...

  3. [LeetCode]3.Longest Substring Without Repeating Characters

    [题目] Given a string, find the length of the longest substring without repeating characters. For exam ...

  4. Longest Substring Without Repeating Characters(最长不重复子序列求解)

    问题描述: Given a string, find the length of the longest substring without repeating characters. Example ...

  5. [LeetCode] Longest Substring Without Repeating Characters

    Given a string, find the length of the longest substring without repeating characters. For example, ...

  6. LeetCode——Longest Substring Without Repeating Characters

    原问题 Given a string, find the length of the longest substring without repeating characters. Example 1 ...

  7. LeetCode:3. Longest Substring Without Repeating Characters

    https://leetcode.com/problems/longest-substring-without-repeating-characters/description/ 内容描述: Give ...

  8. 【LeetCode从零单排】No 3 Longest Substring Without Repeating Characters

    题目 Given a string, find the length of the longest substring without repeating characters. For exampl ...

  9. Leet Code OJ 3. Longest Substring Without Repeating Characters

    题目 Given a string, find the length of the longest substring without repeating characters. Examples: ...

  10. LeetCode Longest Substring Without Repeating Characters

    题意 Given a string, find the length of the longest substring without repeating characters. For exampl ...

最新文章

  1. 使用花生壳自己架设网站:路由器后
  2. 收藏:TerryLee的.NET设计模式系列文章
  3. 影响 PCR 体系蒸发的三大因素
  4. Java数据结构-基于数组的栈和泛型
  5. 1.0jpa 2.0_JPA 2.1如何成为新的EJB 2.0
  6. .net core精彩实例分享 -- 反射与Composition
  7. 携程ELK日志分析平台深耕之路
  8. Python3.x:pytesseract识别率提高(样本训练)
  9. Android 学习资料
  10. IP6K防尘试验测试
  11. word文档添加多个目录
  12. VBA--遍历所有工作表_冻结首行_无视工作表长度_and_所在单元格位置
  13. vhd虚拟硬盘作用_如何从VHD(虚拟硬盘)引导和安装Windows 8 Consumer Preview的指南
  14. 【学习笔记】欧拉函数
  15. win10创意者更新是什么 Win10创意者更新升级方法
  16. 系统集成项目管理工程师+android,系统集成项目管理工程师题库
  17. 前端、后端、学习网址
  18. 中国大学慕课——程序设计与算法(一)第三周测验
  19. DRV8825 TB8825 最佳线路图布局
  20. 思维之道:管理何必那么虚

热门文章

  1. 天空测试显卡软件,BootCamp版本检测工具v1.5.2
  2. ssm mysql动态分页_SSM项目手动分页详解
  3. python精要(72)-VMDK操作(2)
  4. python3随笔-协方差,标准差,方差
  5. 【Python】Pandas groupby加速处理数据
  6. 【深度学习】深度学习中的单元测试
  7. 【机器学习】机器学习的学习经验总结!
  8. 温州大学《深度学习》课程课件(三、浅层神经网络)
  9. 【深度学习】翻译:60分钟入门PyTorch(四)——训练一个分类器
  10. 谈谈考研复试的一些经验和建议