In this problem, we are given a dictionary and a word. Our task is to check if the given wors can be formed using the concatenation of two dictionary words.While forming given words repetition of words is not legal.Let’s take an example to understand the problem, Inputdictionary = {“hello”, “tutorials”, “program” , “problem”, “coding”, “point”} word = “tutorialspoint”OutputyesExplanationtutorialspoint is created using tutorials and point.To solve this problem, we will store all elements of the dictionary in a prefix tree commonly known as a trie. And then search for the prefix of the word in the trie, if found split it ... Read More
In this problem, we are given a dictionary and two words ‘start’ and ‘target’. Our task is to generate a chain (ladder) from start work to target word, the chain is created such that each word differs the other character by only one word and the word should also exist in the dictionary. The target word exists in the dictionary and also the length of all words is the same. The program will return the length of the shortest path from start to target.Let’s take an example to understand the problem, InputDictionary = {‘HEAL’, ‘HATE’, ‘HEAT’, ‘TEAT’, ‘THAT’, ‘WHAT’ , ... Read More
Array and vectors are very important data structures in competitive programming for solving problems. And the STL (Standard Template Library) in c++ programming provide some functions to perform operations of arrays and vectors.Let’s see some of these functions in action, Finding sum, Min and Max of the array/vector − In STL there are function that helps you to find the sum, max, and min of the array/vector. Functions with there function, Finding sumaccumulate(startIndex, endIndex, initialSum)Greatest element of the array/vecto*max_element(startIndex, endIndex)Smallest element of array/vector*min_element(startIndex, endIndex)Program to perform operations on array −Example Live Demo#include using namespace std; int main(){ int array[] ... Read More
Tmux is a terminal multiple for Unix OS. It provides multiple terminal sessions to its users. It is used when we are using cloud-based services (like Azure, AWS) for the creation of separate terminals for different remote users.While working with web services, one needs to create an EC2 instance on the webserver provided by the company to work on it by creating a session.Now, let’s see the steps of working on a UNIX (Ubuntu) webserver.Step 1 − Write/copy the IP address of your AWS console and download the key file from the console. You will get these from your vendor ... Read More
In this program, we are given a file name text.txt. Our task is to print a particular line from the file.For this there are multiple methods in bash script, they are awk, sed, head.Syntax$> awk ‘{if(NR==LINE_NUMBER) print $0}’ filename $> sed -n LINE_NUMBERp filename $head -n LineNumber filename | tail - n + LINE_NUMBERCode to print a specific line in bash programming from file text.txt.Using awk$> awk ‘{if(NR==5) print $0}’ text.txtUsing sed$>sed -n 5p text.txtUsing head$head -n 5 filename | tail - n + 5
Here, we will write a C program that will display the contents of a file page by page as displayed in Linux using the more command.This program will show a specific number of lines on the screen first and then wait for the user to hit enter to move to the next page i.e. next set of n lines.For displaying the content of the file like this we will open the file and print its contents. And maintain a counter for new lines in the file. When this counter reaches n, we will read a key pressed by the user ... Read More
Here, we will write some c programs that won’t compile in c++. Though c++ is considered as a successor of c that has all its features and has compatibility with c code there are some programs that won’t compiler or given a compilation error when compiled with c++ compiler.A list of some of the C programs that won’t compile in c++ are −Call to a function before declaration − In c++, function call before declaration gives compilation error. But this works fine in c.Example Live Demo#include int main(){ printHello(); return 0; } void printHello(){ printf("TutorialsPoint"); }OutputTutorialsPointUsing typecasted ... Read More
The best way to add an event to any element is to use the addEventListener() method.Following is the code to add an event in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result{ font-size: 20px; font-weight: 500; color: rebeccapurple; } Adding event in JavaScript CLICK HERE Click on the above button to increment the font size of above text let resEle = document.querySelector(".result"); document.querySelector(".Btn").addEventListener("click", () => { resEle.style.fontSize = "34px"; }); OutputThe above code will produce the following output −On clicking the ‘CLICK HERE’ button −
Following is the code to decrement a date by 1 day in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result,.sample { font-size: 20px; font-weight: 500; color: rebeccapurple; } JavaScript program to decrement a date by 1 day Decrement Click on the above button to decrement the date by one day let resEle = document.querySelector(".result"); let sampleEle = document.querySelector(".sample"); let date = new Date(); sampleEle.innerHTML = date; document.querySelector(".Btn").addEventListener("click", () => { date.setDate(date.getDate() - 1); resEle.innerHTML = "New Date = " + date; }); OutputThe above code will produce the following output −On clicking the ‘Decrement’ button −
Following is the code for finding keys of a hash in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 20px; font-weight: 500; } Find keys of a hash in JavaScript DISPLAY Click on the above button to display the hash keys let resEle = document.querySelector(".result"); let obj = { firstName: "Rohan", lastName: "Sharma", age: 22, }; document.querySelector(".Btn").addEventListener("click", () => { resEle.innerHTML += "object keys are " + Object.keys(obj); }); OutputThe above code will produce the following output −On clicking the ‘DISPLAY’ button −
 
 Data Structure
 Data Structure Networking
 Networking RDBMS
 RDBMS Operating System
 Operating System Java
 Java MS Excel
 MS Excel iOS
 iOS HTML
 HTML CSS
 CSS Android
 Android Python
 Python C Programming
 C Programming C++
 C++ C#
 C# MongoDB
 MongoDB MySQL
 MySQL Javascript
 Javascript PHP
 PHP 
		