Skip to content

Hrafnagod/tp-sunday-people1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

// Sunday toy problem for the weekend warriors out there

// Two beggars problem: // In the city, two (friendly) beggars found a bunch of gold, stacked into neatly arranged columns, each of different height. // The beggars decided to share the gold, each picking from the far right or the far left of the pile.

/* Example: For golds = [4,2,9,5,2,7], the output should be [14,15]. The pile of most left is 4, The pile of most right is 7, A choose the largest one -- > take 7

The pile of most left is 4, The pile of most right is 2, B choose the largest one -- > take 4

The pile of most left is 2, The pile of most left is 2, A choose the most left one -- > take 2

Etc.

The function should return the two values in an array with two elements: [beggarValue1, beggarValue2] */

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published