Given a set of distinct integers, nums, return all possible subsets (the power set). Note: The solution set must not contain duplicate subsets. Solution: Cascading Approach: Lets say, we have a set S={1,2,3,4}. Pick an element from set, ex. 4, now you have 2 sets – {[], [4]}. Now pick the second element from list ex. 3, now you […]
Category: ideahive
Leetcode – 968 – Binary Tree Cameras
Given a binary tree, we install cameras on the nodes of the tree. Each camera at a node can monitor its parent, itself, and its immediate children. Calculate the minimum number of cameras needed to monitor all nodes of the tree. Example 1: Input: [0,0,null,0,0] Output: 1 Explanation: One camera is enough to monitor all nodes if placed […]
JWT prevents hot linking to your media
Imagine you have some media files published (static http(s) links) on your website for targeted customers, which have been very popular recently. Other sites (search engine) started finding links of your media and putting it on their websites or people started sharing your media links with others. Suddenly you see surge of download on your […]
Configure Nginx as a web server and reverse proxy for Nodejs application on Azure Windows
Introduction: NodeJs applications are “Single threaded Event Loop” i.e there is a single thread listening to all incoming requests. On receiving a request, it immediately publish it to its internal “event queue” and is ready to receive the next request. It also polls event queue for any pending tasks and processes Non-blocking I/O tasks. For […]
Message compression on WCF
Windows Communication Foundation (WCF) is a message-based communications infrastructure. So developers are concerned about the wire footprint (size) of message sent across the network, the text-based encoding of XML poses challenges for efficient transfer of binary data because to fit binary data into XML text, the common approach is to encode them using the Base64 […]