UPDATE : The Article currently contains Brute-Force Approaches for Three-sum Problem, Will update the better approaches soon.
I have started exploring Advent of Code for the year 2020. For Day 1, The scenario included writing a program to find the product of ’n’ numbers that add up to the given target sum value. So, Ideally finding those two/three elements is the key. This Article explains various ways you can achieve this.
Given an array of integers nums
and an integer target_sum
, return two numbers such that they add up to target_sum
.
For example, suppose your sample input contained the following and the target sum provided is…
Node.js is an open source, cross-platform, asynchronous event-driven JavaScript runtime. Node.js can be used to write command line tools and server-side scripts outside of a browser. It is designed to build scalable network applications. You need to use JavaScript programming language to code in Node.js.
To get started with Node.js development, you must first download and install Node.js in your system.
Approach 1 :
The first approach to install Node.js is simple and straight forward. You must visit The official Node.js website and follow the installation instructions here : https://nodejs.org
Approach 2 :
Alternatively, if you are interested in installing Node.js using NVM (node version manager) you must first install NVM . To do so, follow instructions in below…
Deno is fairly new environment compared to Node. One of the first thing that a developer would want to do while learning Deno is to build CRUD api’s. Deno has several several projects which help us achieve this namely, deno-express, oak, servest, deno-drash,and pogo. In this article we will learn about building a todo list using Deno and Oak.
Oak is project that has been inspired by Koa, a popular Node.js HTTP middle-ware framework. We will use oak and Deno to build a small application which will deal with todos list. …
Deno is a secure runtime for JavaScript and TypeScript. It aims to provide a productive and secure scripting environment for the modern programmer. It is built on top of V8, Rust, and TypeScript. It was created to address several shortcomings of Node JS namely,
· Address the design shortcomings.
· Make use of promises in a better way.
· Address security issues (remember in a Node program you have access to system calls)
· The usage of Build System — GYP
· Usage of package.json and node_modules to allow to store all node_modules and their sub-modules rather than absolute import of specific sub-module alone. …
Dynamic Programming simply means optimization of your code over plain recursion. The idea is to store the results of sub-problem and reuse it later when needed to do same calculations.
Let’s see how Dynamic Programming makes its program more efficient by using Memoization. We will write finding “n-th” Fibonacci Number programme to achieve this.
Fibonacci Problem — General Approach
Following diagram shows the general way most of us approach solving Fibonacci Number Problem. Here we have a function fib(n) which accept a parameter “n” and gives the output of n-th element in fibonacci series.
npm adduser
ornpm login
Lets’ create a simplest code by running following commands sequentially.
mkdir logger-app
cd logger-app
npm init -y
npm i chalk
Create a file called index.js and copy the following content.
const chalk = require('chalk');class Log { info({ msg = "", data = "" }) {
console.log(`"${chalk.green(msg)}", "${data}" was posted on "${Date()}" with status ${chalk.green('✓')}`)
} error({ msg = "", data = "" }) {
console.log(`"${chalk.red(msg)}", "${data}" was posted on "${Date()}" with status ${chalk.red('X')}`)…
This article helps in understanding how the “create-react-app” command works behind the scene. You can build a react application from the scratch using webpack, babel and react libraries.
Steps that you should follow to build a React application from scratch.
Open the command prompt and start executing the following commands sequentially.
1. mkdir webpack-bolier-plate
2. cd webpack-bolier-plate
3. npm init -y
4. npm install react react-dom
5. npm install --save-dev @babel/core @babel/preset-env @babel/preset-react css-loader html-webpack-plugin style-loader webpack webpack-cli webpack-dev-server babel-loader
Azure App Service is a PaaS that allows you to host web, mobile apps, web API’s and logic apps.This article explains about how to host your react app on azure app service. Assuming you have npm and VS Code installed in your machine, follow below steps sequentially.
2. Create a react app by running ‘npx create-react-app my-app‘ command.
3. The folder structure of the app should look like this.
About