A trie (pronounced as “try”) or prefix tree is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker. Implement the Trie class: Input [“Trie”, “insert”, “search”, “search”, “startsWith”, “insert”, “search”] [[], [“apple”], [“apple”], [“app”], [“app”], [“app”], [“app”]] Output: [null,… Continue reading
Category: Programming
LFU Cache Implementation – LeetCode
Design and implement a data structure for a Least Frequently Used (LFU) cache. Implement the LFUCache class: Example 1: Input [“LFUCache”, “put”, “put”, “get”, “put”, “get”, “get”, “put”, “get”, “get”, “get”] [[2], [1, 1], [2, 2], [1], [3, 3], [2], [3], [4, 4], [1], [3], [4]] Output [null, null, null, 1, null, -1, 3, null, -1, 3, 4] This… Continue reading
Calculate size of drive in C# – How to find directory drive?
In this post, we will be discussing how to find the directory drive and the size of drive in C#. This can be useful where application might want to check for drive size or remaining size of drive before getting started. Below is the snippet of implementation: To get the drive information in C#, one… Continue reading