Overview The scanf gem is no longer a bundled gem that comes with Ruby Installation. It has to be specifically installed. Simply add the below line to your Gemfile and then do…
Author: admin
Fix LoadError cannot load such file — e2mmap in Ruby 2.7.0
Overview The e2mmap gem is no longer a bundled gem that comes with Ruby Installation. It has to be specifically installed. Simply add below line to your Gemfile and then do ‘bundle’…
Delete a nested key in a hash in Ruby Language
Overview It is possible to delete nested keys in a hash in Ruby Language. Let’s see examples One Level Nested Key Here is the code to delete the key in a hash…
Ruby regex match in an if check
Overview We can use the below sign to have ruby regex match in an if check Program Let’s see an example of the same Output Note: Check out our system design tutorial…
Program for Longest Word in Dictionary through Deleting
Overview A string and a dictionary of words are given. The objective is to find the longest word in the dictionary which is present as a subsequence in the given string. If the…
Traverse three arrays together in Ruby Language
Overview It is possible to traverse three arrays at once in Ruby. It can be done using the .zip function. Here is the doc link for the zip function https://ruby-doc.org/core-2.0.0/Array.html#method-i-zip Let’s see…
Remove Linked List Elements Program
Overview Given a linked list and a value, delete all nodes from the linked list whose value is equal to the given value. Example 1 Example 2 Program Below is the program…
Understanding Directory-Based Sharding
Overview In this tutorial, we will try to understand directory-based sharding. Other than directory-based sharding there are two types of sharding as well Key Based Sharding Range Based Sharding Directory-based sharding keeps…
Count unguarded cells program
Overview Two integers m and n are given which represent an m*n grid. Other than that two 2D integer arrays are also given guards where guards[i] = [rowi , columni]. It represents…
Recover Binary Search Tree Program
Overview The root of a binary search tree is given. Two nodes of the binary search tree have been swapped. We need to fix the binary tree and recover the original structure…