My First Leetcode Python challenge

Kenneth Law
Jul 2, 2021

I have solved my first Leetcode challenge in Python. Coagulation!

I record my thinking process in this ‘Two Sum’ exercise.

First, the three example output are consecutive indices i.e. nums[1] +nums[2]. One for loop is enough for this question.

I got a correct answer after clicking the ‘Run Code’. Great!

However, I neglect one situation that is the slices are not consecutive.

Two for loops are needed for solving it.

Cool~

--

--