《Java语言程序设计(基础篇)》(第10版梁勇著)第二十二章练习题答案.docxVIP

  • 32
  • 0
  • 约7.58万字
  • 约 69页
  • 2021-10-16 发布于天津
  • 举报

《Java语言程序设计(基础篇)》(第10版梁勇著)第二十二章练习题答案.docx

《Java 语言程序设计(基础篇) 》(第 10 版 梁勇 著) 第二十二章 练习题答案 22.1 public class Exercise22_01 { public static void main(String[] args) { java.util.Scanner input = new java.util.Scanner(System.in); System.out.print( Enter a string: ); String s = input.nextLine(); System.out.println( Maximum consecutive substring is + maxConsecutiveSortedSubstring(s)); } /** The worst - case complexity is O(nA2), where n is s.length(). Can you improve the algorithm? */ public static String maxConsecutiveSortedSubstring(String s) { int [] maxConsecutiveLength = new int [s.length()]; int current = 0; for ( int i = 1; i s.length

文档评论(0)

1亿VIP精品文档

相关文档