• [Network] What is a socket

    [Network] What is a socket

    1. Packet before socket Network Interface Card(NIC) receives packet from the outside network. These packets are handed over to Network Stack of an operating system. The Network Stack refers to the software module that handles TCP/IP protocol. When an application sends data to TCP/IP stack, the headers should be added. On the contrary, when application…

  • [LeetCode] 1062. Longest Repeating Substring

    [LeetCode] 1062. Longest Repeating Substring

    Description Given a string s, find the length of the longest  substring without repeating characters. Example 1: Input: s = “abcabcbb” Output: 3 Explanation: The answer is “abc”, with the length of 3. Example 2: Input: s = “bbbbb” Output: 1 Explanation: The answer is “b”, with the length of 1. Example 3: Input: s = “pwwkew” Output:…

  • [Go] what is a time in go

    [Go] what is a time in go

    Time is an agreement We often take time for granted, considering it as omnipresent and essential as air. Yet, when it comes to programming, handling time can be surprisingly complex. The Go programming language provides a robust time package to manage these complexities efficiently. Let’s take a simple look at the ‘Time’ struct. The wall…

  • [Kubernetes] Probes

    [Kubernetes] Probes

    Probes There are three kinds of probes in Kubernetes(k8s): startup, liveness, and readiness. If the startup probe succeeds, the liveness and readiness probes get started. Containers that takes some time to get started can benefit from startup probe. As long as startup probe is not finished, K8s will never restart the pod. Therefore, the startup…

  • [LeetCode] 271. Encode and Decode Strings

    [LeetCode] 271. Encode and Decode Strings

    Description Design an algorithm to encode a list of strings to a string. The encoded string is then sent over the network and is decoded back to the original list of strings. Machine 1 (sender) has the function: string encode(vector<string> strs) { // … your code return encoded_string; } Machine 2 (receiver) has the function: vector<string> decode(string s)…

  • [LeetCode] 49. Group Anagram

    [LeetCode] 49. Group Anagram

    Description Given an array of strings strs, group the anagrams together. You can return the answer in any order. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. Example 1: Input: strs = [“eat”,”tea”,”tan”,”ate”,”nat”,”bat”] Output: [[“bat”],[“nat”,”tan”],[“ate”,”eat”,”tea”]] Example 2: Input: strs = [“”] Output: [[“”]]…