Parent map should contain both key and value as the generic type. But Prateek Bhaiya has taken int in the value field… Is it right?
Parent array type
@googlerpratiik since all the values, parent nodes as well as the child nodes, in this graph are of int type, it is right to make the value field of the parent map as int. But it is only right in this example because parent nodes are of int type only. Had the parent nodes of any other type then this approach would have been wrong and making the generic type would have been better thing to do.
Hope this helps.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.