Skip to content

Conversation

vay4ie
Copy link

@vay4ie vay4ie commented Sep 24, 2022

No description provided.

@vay4ie vay4ie changed the title Partition Homework Homework Oct 1, 2022
Comment on lines +6 to +10
for _, tc := range []tests{
{"#1: no repeated elements", Input{[]int{8, 4, 1, 0, 5, 9, 3, 7, 2, 6}, 4}, 5},
{"#2: repeated elements", Input{[]int{9, 6, 1, 7, 5, 9, 6, 5, 2, 6}, 9}, 4},
{"#3: empty left side", Input{[]int{9, 6, 1, 7, 5, 9, 6, 5, 2, 0}, 9}, 0},
} {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add more tests (not only given examples).

Comment on lines +15 to +16
logN := math.Log2(float64(n)) //taking logarithm with base of 2 from N
return logN == math.Round(logN) //if number is integer (has no leftover)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please implement this function without using math package (you will need a recursion).


func maxNumber(s []int) {
if len(s)-1 > 0 {
quickSort(s) // programmers must be lazy ;)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the most implementation. Can you improve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants