Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WK3/1 - Permuting Arrays #39

Merged
merged 4 commits into from
Feb 10, 2025
Merged

WK3/1 - Permuting Arrays #39

merged 4 commits into from
Feb 10, 2025

Conversation

treejamie
Copy link
Owner

@treejamie treejamie commented Feb 6, 2025

Permuting Arrays

I don't really understand mathematical notation, so reading some of these challenges, is, well - challenging.

So I asked chatGPT for some help understanding the intention.

What You Need to Do:

Understand the requirement:

You have two arrays, A and B, of equal length.
You also have a number k.
You need to check if you can rearrange A and B so that for every index i, the sum of the elements from both arrays at > that index is at least k (i.e., A'[i] + B'[i] ≥ k for all i).
Figure out a strategy to achieve this:

Since you're allowed to reorder the arrays, you should think about how to pair elements from A and B to maximize your chances of meeting the condition.

Decide the output:

If you can successfully form valid pairs for all indices, print "YES".
Otherwise, print "NO".

Closes #31

@treejamie treejamie merged commit 18a4347 into main Feb 10, 2025
1 check passed
@treejamie treejamie self-assigned this Feb 10, 2025
@treejamie treejamie added this to the Week 3 milestone Feb 10, 2025
@treejamie treejamie deleted the wk3/1/-permuting branch February 12, 2025 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

WK3/1 - Permuting Two Arrays
1 participant