其实题目很简单,就是计算一个整数数组中,连续的最大子数组。

 

  • 一开始想到肯定是个O(n*n)的算法:maxSectionGood 
  • 后来使用递归O(n*log(n)):maxSectionExcellent 
  • 最经典的是最后一个算法,提升到了O(n):maxSectionPrefect
Google 笔试题:

input: an array of int which represent a binary number the bit is 1
output: the count of 1 triple of the number

input: an array of int
output: the max sum of continual element of the array of input

 

 

Copyright © 2024 Teddy Yan
Powered by .NET 8.0 on Kubernetes