c++
Connect n ropes with minimal cost
Given n ropes of different lengths, connect them into a single rope with minimum cost. Assume that the cost to connect two ropes is the same as the sum of their lengths. For example, The Read more…
Given n ropes of different lengths, connect them into a single rope with minimum cost. Assume that the cost to connect two ropes is the same as the sum of their lengths. For example, The Read more…
Given a level order representation of a complete binary search tree, print its elements in increasing order. For example, the level order representation of the complete BST below is [15, 10, 20, 8, 12, 18, Read more…
Given an array of words where no word is the prefix of another, find the shortest unique prefix to identify each word in the array uniquely. For example, The idea is to construct a Trie Read more…
Given a binary tree, extract all its leaves into a doubly linked list, i.e., remove all leaf nodes from the binary tree and construct a doubly linked list out of them. The extraction should be Read more…
Write an efficient algorithm to fix the children-sum property in a given binary tree. The only operation allowed is an increment operation on the node’s value For a tree to satisfy the children-sum property, each Read more…
Given an array, count the total number of triplets, which leads to an inversion. If (i < j < k) and (A[i] > A[j] > A[k]), then we can say that triplet (i, j, k) Read more…
Let’s start 2021 with a fun one. How can tools help projects get contributors up to speed? In this webinar, Steve Piercy, a long-time maintainer with a popular open source project, shows us how he Read more…
The Kickstarter for my latest book, Pillow: Image Processing with Python, was fully funded yesterday. I know it can be hard to decide if you want to buy a book without seeing it, so I Read more…
Matt Harrison asked me to take part in his latest course, Effective Book Authoring. This course will help you learn how to write a technical book. Matt interviewed me about how I approach book writing. Read more…
I am happy to announce my latest book project, Pillow: Image Processing with Python. This book will teach you how to use Pillow, the “friendly” fork of the Python Imaging Library (PIL). You can purchase Read more…