Help me understand plagiarism concerning computer programming
As mentioned in my comment, this does not seem like plagiarism (as described here) - as no written material has been copied between the students.

Specifically:


  student "A" decides to help is class-mate and the other student "understands" the solution and implement the same


Student A tutored the other student. At the very most, student A could have been acknowledged, but really is not necessary.


  he discusses these steps with a "person who is good at coding". the person tells him the libraries to use and discussions(no coding) . He does all that and takes his help for "debug" "when he got stuck" and WRITES IN HIS OWN WORDS


This is also really tutoring.

Both are rather nice examples of sharing knowledge and skills.

It is probably a case that the students helping out did so because they are just simply happy to help.

One major thing to consider, these examples show classmates collaborating - drawing on each other's strengths. Each person in those interactions already benefit.  This is also touches on a transferable skill - collaborative work.

But whether or not the level of collaboration is within the rules there is another matter (but really should be checked).

Not everything needs to result in a person's name in lights. These are not really examples of plagiarism, but to be absolutely certain, it would not hurt to read up on the institution's plagiarism policies.