HomeInterview QuestionsCan you add values from both these lists?

Can you add values from both these lists?

🟡 Medium Coding Junior level
4Times asked
Jul 2026Last seen
Jul 2026First seen

💡 Model Answer

To combine two lists in Python you can use the + operator or the extend() method. For example, if list1 = [1, 2, 3] and list2 = [4, 5, 6], then combined = list1 + list2 yields [1, 2, 3, 4, 5, 6]. Using extend modifies the original list: list1.extend(list2) results in list1 becoming [1, 2, 3, 4, 5, 6]. Both approaches run in O(n + m) time, where n and m are the lengths of the two lists, and O(n + m) space if you create a new list. If you need to avoid copying, you can iterate over both lists and process elements on the fly.

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

🎤 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers on a discreet on-screen overlay.

Get Assisting AI — Starts at ₹500