DEV Community

Mukilan Palanichamy
Mukilan Palanichamy

Posted on

My journey in competitive programming

Anagram Check and Cookies Problem for today.

Hello, guys

I have had a sort of scattered day today. Kind of feel not-so-productive because of holiday lag, but I have been able to complete my task of the day. Being a new learner in Python using linked lists, I had really loved picking up all new concepts today. This is what I did:

Anagram:

To start with, I undertook an easy problem — checking to see if a given array is an anagram. A good example of an anagram is when two arrays, or strings, have identical elements, but in reverse order. I compared the elements of both arrays and checked if these were identical in terms of frequency and content. This proved to be a good, straightforward sort of problem.

Image description

Cookies Problem:
The next problem I had was the "cookies problem." I'd say this is a greedy algorithm problem, wherein cookies are distributed to children depending on their greed factor and the size of the cookies. The objective is to satisfy as many children as possible by giving them the biggest cookie they can handle according to their greed. It took me a pretty long time to comprehend and solve, but this was really an interesting challenge. Overall, I'm happy with how the day turned out, and it ended perfectly as I look forward to a great weekend ahead!

Image description

Thanks!

Top comments (0)