Go Day 2: Leetcode — 9 Easy Problems

Arjun Sunil Kumar
Rust Go C++
Published in
2 min readJun 5, 2022

Today, we will be using our GoLang skills to solve a few easy LC problems. The learning curve of GoLang has been very less. It is super fun and easy to write golang code. Let's jump right into it.

1. Palindrome Number

2. Valid Parenthesis

Learning:

  • When you are declaring and initializing a map, you don’t need to use make(). You can directly use {}, and : to init values.
  • rune is similar to char in java.
  • tuple order: (index, val, exists ).
  • Deleting the top most element is similar to removing the last element in the queue. So you can use: char_stack[0 : len(char_stack)-1]

Reference:

3. Merge Two Sorted List

Learnings:

  • Use &ListNode{} to create a reference ListNode using a pointer.
  • Pair result
  • type <Name> struct

Reference:

4. Remove Duplicates from Sorted Array

OR

5. Search Insert Position

6. Maximum Subarray

7. Length of Last Word

8. Climbing Stairs

9. Remove Duplicates from Sorted List

Conclusion

This is it for today! Soon, we will look into TinyKV source code in Go.

--

--

Arjun Sunil Kumar
Rust Go C++

Writes on Database Kernel, Distributed Systems, Cloud Technology, Data Engineering & SDE Paradigm. github.com/arjunsk