-
8 Patterns Review For Successful Coding Interview
8 Patterns Review For Successful Coding Interview This is nothing but quick 5 min revision before going to interview. Visit https: https://codeandalgo.com for more such contents
-
Golang Channel
Golang Channel Send & Receive Golang Channel Buffered Channels Use Cases Advantages Example Unbuffered Channel Use Cases Advantages Example When to Use Each Real-World Scenarios Conclusion Both unbuffered and buffered channels have their place in real-world Go programming. The choice depends on whether you need tight synchronization or more flexibility and decoupling in your concurrent…
-
Golang For Loop
Arrays When you use range with an array or a slice, it iterates over the indices and values of the elements. Strings When iterating over a string with range, it returns the index and the Unicode code point (rune – int32) of each character. Map When you use range with a map, it iterates over…
-
Strings
Slice vs Array In Go, the syntax for arrays and slices differs, and the presence or absence of a number within the square brackets ([]) distinguishes them: Array Slice To summarize: Slices in Go are more commonly used due to their flexibility, while arrays are used when you need a fixed-size collection. Golang Strings Copy…
-
Golang Top 10 Features
Golang Top 10 Features 1. Tuple Assignment in Go Tuple assignment in Go is generally faster because it is a single, atomic operation that the Go compiler can optimize effectively. Go has several features and idioms similar to tuple assignment that help write concise and efficient code. Here are some notable ones: 2. Multiple Return…
-
Reverse Vowels of a String
Problem Statement LeetCode#345 Given a string s, reverse only all the vowels in the string and return it. The vowels are ‘a’, ‘e’, ‘i’, ‘o’, and ‘u’, and they can appear in both lower and upper cases, more than once. Example 1: Input: s = “hello” Output: “holle” Example 2: Input: s = “leetcode” Output: “leotcede” Constraints: Golang Code Reverse Vowels…
-
Can Place Flowers
Problem Statement You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent plots. Given an integer array flowerbed containing 0‘s and 1‘s, where 0 means empty and 1 means not empty, and an integer n, return true if n new flowers can be planted in the flowerbed without violating the no-adjacent-flowers rule and false otherwise. Example 1: Input: flowerbed =…