Category Archives: Misc

Miscellaneous

Terminal Mail and Linux Security Mail

While working on Eudyptula Challenge, I was needed to mail them the tasks in the plain text format, since the server rejects all the HTML mails it receives due to security reasons. So I started mailing them from terminal which is quite simple to configure and very fast. HTML vs Plain text Mail Actually the… Read More »

Subtree with given sum in a Binary Tree

You are given a binary tree and a given sum. The task is to check if there exist a subtree whose sum of all nodes is equal to the given sum. Examples: // For above tree Input : sum = 22 Output: “Yes” // sum of all nodes of subtree {1, 7, 12, 2} =… Read More »

Minimum cost to fill given weight in a bag

You are given a bag of size W kg and you are provided costs of packets different weights of oranges in array cost[] where cost[i] is basically cost of ‘i’ kg packet of oranges. Where cost[i] = -1 means that ‘i’ kg packet of orange is unavailable Find the minimum total cost to buy exactly… Read More »

Count Pairs Of Consecutive Zeros

Consider a sequence that starts with a 1 on a machine. At each successive step, the machine simultaneously transforms each digit 0 into the sequence 10 and each digit 1 into the sequence 01. After the first time step, the sequence 01 is obtained; after the second, the sequence 1001, after the third, the sequence… Read More »

K’th Boom Number

Boom numbers are numbers consisting only of digits 2 and 3. Given an integer k (0<k<=10^7) , display the k-th Boom number. Examples: Input : k = 2 Output: 3 Input : k = 3 Output: 22 Input : k = 100 Output: 322323 Input: k = 1000000 Output: 3332322223223222223 Reference: http://www.spoj.com/problems/TSHOW1/ The idea is… Read More »

How to write Regular Expressions?

A regular expression (sometimes called a rational expression) is a sequence of characters that define a search pattern, mainly for use in pattern matching with strings, or string matching, i.e. “find and replace”-like operations.(Wikipedia). Regular expressions are a generalized way to match patterns with sequences of characters. It is used in every programming language like… Read More »

How to read content of GeeksforGeeks in an organized way?

We have been trying to organize content of geeksforgeeks. We added below pages for this purpose. C C++ Java Python Algorithms Interview Corner GATE Corner Data Structures The above pages contain all related article at one place, but do not provide proper navigation through articles. GeeksforGeeks and GeeksQuiz are quite limited in functionalities which motivated… Read More »