We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Happy Ladybugs
Happy Ladybugs
Sort by
recency
|
525 Discussions
|
Please Login in order to post a comment
Here is problem solution in Python, java, c++, c and javascript -https://programmingoneonone.com/hackerrank-happy-ladybugs-problem-solution.html
Here is my c++ solution, you can watch the explanation here : https://youtu.be/khDcPEl6to0
Here is my Python solution! If we have at least one empty square, then we can move any of the ladybugs anywhere. This means that the only cases that work are if there are more than one empty square and an even number of each type, or if there are no empty squares but all the ladybugs are already happy.
Python3; After realizing 1 empty field gives you possibility to place any existing color anywhere