odd even linked list | odd even linked list python leetcode | leetcode 328 | interview question

preview_player
Показать описание
Please like the video, this really motivates us to make more such videos and helps us to grow. thecodingworld is a community which is formed to help fellow student and professionals looking to crack the “coding interviews”.

We love solving and sharing problems which are frequently asked in technical interviews and voted by community at various websites.

✅ For more and upcoming updates join our community

#leetcode #python
Рекомендации по теме
Комментарии
Автор

Consider there is a singly linked list of integers. Find the even integers and odd integers in the list and keeping them in the same order. Also, find and remove the duplicate numbers from the list. The sample output attached below.
Original List: 1, 8, 4, 3, 6, 4, 5, 9, 1, 12, 8, 1, 2
Odd List: 1, 3, 5, 9
Even List: 8, 4, 6, 12, 8, 2
Duplicate: 1, 8, 4, 1

MuhammadShahbaz-dkch
Автор

Well done! Please what device do you use for writing and recording? Thanks

ogsconnect
Автор

Well done! But this clearly not O(1) space. You're building a new linkedlist that is at least half of the original linked list which is equivalent to O(n). Good job though.

ogsconnect
Автор

At the end I created a new result node and stored the odd values, and even values, by iterating each one of them; IDK where I am getting this idea, I really haven't thought you could add the oddNodes next as the evenNodes.

lightsam
Автор

Thanks for the video.Small clarification, in the question they mentioned to solve the problem in O(1) space complexity right, we are using two different linked list, will it be O(1) solution ? please correct me if I am wrong.

saimadhupolamuri
welcome to shbcf.ru