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

Create 0280-wiggle-sort.java #3717

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dmgodoy
Copy link

@dmgodoy dmgodoy commented Nov 4, 2024

Important

Please make sure the file name is lowercase and a duplicate file does not already exist before merging.

Comment on lines +3 to +5
for(int i = 1; i < nums.length; i++){
if((i % 2 == 0 && nums[i] > nums[i - 1])
|| (i % 2 == 1 && nums[i] < nums[i - 1]))
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's better to have a space after control flow statements. There should also be an additional space between the for loop and the opening bracket

Comment on lines +9 to +10
private void swap(int[] nums, int i, int j){
int temp = nums[i];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add a space before the opening bracket

@Ykhan799
Copy link
Collaborator

Ykhan799 commented Nov 5, 2024

@dmgodoy Solution looks good. Please address my comments regarding spacing. The spaces will help improve readability of your code

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