0

Please help me

Hey everyone, I've been learning python for over a year and the amount of things I've managed to learn aren't so many. I've learnt the basics and so many concepts but when I go to leetcode and I try to apply my knowledge, I just can't seem to figure it out, even for easy problems like Two Sum. Sometimes I even wonder if I'm the problem. Please assist me.

29th Oct 2025, 1:30 PM
Kuri
Kuri - avatar
3 Antworten
+ 3
Kuri #The basics of most codes is defining what you want to do def add(a,b): # the function return a+b # simplistic algorithm a = int(input()) # no. 1 b = int(input()) # no. 2 print(add(a,b)) # call function Math wording and interpretation sometimes can be confusing .. Leetcode Task: Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. Input: nums = [2,7,11,15], target = 9 Output: [0,1] nums = [2,7,11,15] a= int(input()) # no. 1 b= int(input()) # no. 2 # if target is 9 a = 0 and b = 1 print(nums[a] + nums[b])
29th Oct 2025, 2:51 PM
BroFar
BroFar - avatar
+ 1
Kuri here are two examples in this code... https://sololearn.com/compiler-playground/cjKwlEx6zJTR/?ref=app
29th Oct 2025, 3:51 PM
BroFar
BroFar - avatar
+ 1
solving coding problems, math problems or using code to simulate real world activity often start with being able to identify the main elements, the intended outcome and creating their symbolic representation in your code. this is probably the hardest part. you are transforming one thing into another thing. that's why you shouldn't just memorize coding syntax, keywords and data structures. you should also know how they behave, their capabilities and limitations. the programming lanuage's components and semantics are your raw materials and building blocks for problem solving. learning without understanding is never useful. open a solved leetcode problem. go back and forth between the problem and solution and try to understand which part of the problem got converted into which part of the code. what operations were used. why was it used. understand the process. learning this way will slowly give you the mindset of a programmer.
30th Oct 2025, 2:52 AM
Bob_Li
Bob_Li - avatar