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

LC problem Separate Black and White Balls java code added #81

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

Krushit-Babariya
Copy link
Contributor

🚀 What does this PR do?

  • Adds a solution for the LeetCode Daily Challenge on (October 15, 2024) in Java
  • The approach calculates the minimum number of swaps needed to move all '0's to the left side of the string while maintaining the relative order of '1's.

📝 Issue Reference:

Fixes issue: #15 (Replace with the actual issue number)

🔍 Checklist:

Please ensure the following before submitting your PR:

  • I have placed my solution in the correct folder (solutions/day15/).
  • My code follows clean coding practices and is efficient.
  • I have added comments in my code to explain the approach.
  • I have tested the solution on LeetCode and it works correctly.

🔧 Solution Details:

  • Language Used: Java
  • Time Complexity: O(n), where n is the length of the string.
  • Space Complexity: O(n), due to the character array used to store the string.

🌟 Additional Notes (if any):

  • The approach efficiently tracks the number of '0's and calculates the swaps required without changing the order of '1's.

@arya2004 arya2004 merged commit 3d5825e into arya2004:main Oct 15, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants