File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
interview_preparation_kit/dynamic_programming Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 44 */
55
66const bigIntMax = ( ...args ) =>
7- args . reduce ( ( m , e ) => ( e > m ? e : m ) , BigInt ( 0 ) ) ;
7+ args . reduce ( ( m , e ) => {
8+ const _e = BigInt ( e ) ;
9+ const _m = BigInt ( m ) ;
10+ return _e > _m ? _e : _m ;
11+ } , BigInt ( 0 ) ) ;
812
913function maxSubsetSum ( arr ) {
1014 const arrCopy = arr . map ( BigInt ) ;
Original file line number Diff line number Diff line change @@ -17,11 +17,11 @@ function plusMinus(arr) {
1717 }
1818 }
1919
20- const result = [ ] ;
21-
22- result . push ( ( positives / arr . length ) . toFixed ( 6 ) ) ;
23- result . push ( ( negatives / arr . length ) . toFixed ( 6 ) ) ;
24- result . push ( ( zeros / arr . length ) . toFixed ( 6 ) ) ;
20+ const result = [
21+ ( positives / arr . length ) . toFixed ( 6 ) ,
22+ ( negatives / arr . length ) . toFixed ( 6 ) ,
23+ ( zeros / arr . length ) . toFixed ( 6 )
24+ ] ;
2525
2626 return result . join ( `\n` ) ;
2727}
You can’t perform that action at this time.
0 commit comments