# I wrote the first leetcode program after a Year and made simple mistakes.

Today, I tried to use my problem-solving muscle and tried solving easy-level problems on [leetcode](https://leetcode.com/).

At first, this problem looked very easy to me, So I noted down important pieces of information and started to solve the problem on paper. Still, I took many things for granted in my mind during this note-down process and I forgot to take minor details in the code, You can see what I mean by looking at the code and picture of my note shared below.

```java
dsclass Solution {
    public int[] twoSum(int[] nums, int target) {
        // int[] ans = {-1,-1};
        for(int i =0; i<nums.length; i++){
            // ans[0] = i;
            for(int j = i+1;j<(nums.length);j++){
                if(nums[i]+nums[j] == target){
                    return new int[]{i,j};
                }
            }
        }
        return new int[]{};
    }
}
```

![Image of my notes for the problem and solution on paper.](https://cdn.hashnode.com/res/hashnode/image/upload/v1731226063007/75f8874a-bfe3-4998-ba25-733133b995ca.jpeg align="center")

Thank you for reading, follow me if you want to join the journey of learning to solve problems and coding.
