When your solution is correct but too slow ‼️ #computerscience #softwareengineer #coding #python

preview_player
Показать описание

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

Use the window method. Sort the array and have an iterator iterates through the loop. Then use the window method for the elements from the iterated item to the end and initialized 2 pointers, one at the left of the window and one next to the left. Then we move the pointers based on the condition. If the sum is too small, move the left pointer, if the sum is too big, move the right pointer, if it's equal, move both pointers. Repeat this until 2 pointers meet up and end the program if the iterator bypasses n-2th item (index n-3) then stop the program and return the function.

iaminfinityiq
Автор

Len is not O(n) it is O(1) since it can be stored as each element is added

fenrirgreyback
Автор

I’d do it this way:
result = []
for i in nums:
if len(str(i))==3:
if == 3:
result.append(i)
return result

ДмитроПрудко
Автор

I'm a beginner programmer, and this looks rather tough. I look forward to you showing us the answer so we can learn how to reconstruct this code to be faster!

My only guess is we'd use short circuiting perhaps! 😅 I'm not 100% sure!

fresco_animations
Автор

How to use this Kira page??? Do i need a teachercode? Pls help!

bonsai
Автор

What's the problem. I want to try it.

puddlejumper
visit shbcf.ru