Skip to content

Latest commit

 

History

History
53 lines (41 loc) · 1.51 KB

2020-11-18-Dave-Mason.md

File metadata and controls

53 lines (41 loc) · 1.51 KB

Articles:

  • none

Links:

  • none

Discussion:

  • :> implementation ... added to Object Class
  • refactoring findLucky, maxConsecutiveOnes
  • implemented maxDepth
findLucky
	^ self frequencies 
	    :> keysAndValuesRemove: #~~
	    :> keys 
	    :> inject: -1 into: #max:.

maxConsecutiveOnes
  ^ self groupByRuns: [ :e | e == 1 ] 
      :> collect: #sumNumbers
      :> max.

"this is actually broken"
maxDepth
  ^ self select:  [ :e | '()' includes: e ]
      :> collect: [ :e | e == $( ifTrue: 1 ifFalse: -1 ] as: Array
      :> scan: #+
      :> max.

Previous To Do:

To Do: