DEV Community

Rishitha Nallapureddy
Rishitha Nallapureddy

Posted on

Journal - 20-11-24

Hi, Folks! Today, I solved three questions on LeetCode: Maximize greatness in array, Push Dominoes, and Beautiful Arrangements. All these problems may seem tough at first, but using data structures, we can develop a solid logic to solve them easily. With continuous practice, we can improve ability to frame the logics.

As a Beginner, to frame good logic. Firstly, we should have clarity on the problem statement. Next, try to breakdown entire process into small steps and give code to each small step. In this way we can complete the problem. If, we need to see some other approaches then just try to dry run the code this makes even more clear with approach.

Beautiful Arrangements : To solve this problem, we can use the backtracking concept. If we find the valid element, the code will traverse to the next. If, not it will backtrack to another position. In this we can solve this problem.

In this way every problem has some logic try to find it and solve the problem. Some times we might not come up with the logic in that case we can find the approach and dry run the code. Dry running the code will be really helpful.

I hope my experience will be helpful.

Top comments (0)