Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Server Side Programming Articles - Page 1794 of 2650
331 Views
Suppose we have a list of positive integers; the adjacent integers will perform the float division. So for example, [2, 3, 4] -> 2 / 3 / 4. Now, we can add any number of parenthesis at any position to change the priority of these operations. We should find out how to add parenthesis to get the maximum result, we have to find the corresponding expression in string format. Our expression should NOT contain redundant parenthesis. So if the input is like [1000, 100, 10, 2], then the result will be “1000/(100/10/2)”.To solve this, we will follow these steps −n ... Read More
814 Views
Python being a versatile language can handle many requirements that comes up during the data processing. When we need to convert a decimal number to a binary number we can use the following python programs.Using formatWe can Use the letter in the formatter to indicate which number base: decimal, hex, octal, or binary we want our number to be formatted. In the below example we take the formatter as 0:0b then supply the integer to the format function which needs to get converted to binary.Example Live DemoDnum = 11 print("Given decimal : " + str(Dnum)) # Decimal to binary ... Read More
511 Views
Data analytics throws complex scenarios where the data need to be wrangled to moved around. In this context let’s see how we can take a big list and split it into many sublists as per the requirement. In this article we will explore the approaches to achieve this.With zip and for loopIn this approach we use list dicing to get the elements from the point at which the splitting has to happen. Then we use zip and for loop to create the sublists using a for loop.Example Live DemoAlist = ['Mon', 'Tue', 'Wed', 6, 7, 'Thu', 'Fri', 11, 21, 4] ... Read More
471 Views
Suppose we have a list of 24-hour clock time points in "Hour:Minutes" format, we have to find the minimum minutes difference between any two time points in the list. So if the input is like [“12:30”, ”15:17”], so this will return 167.To solve this, we will follow these steps −Define an array called ok of size 24*60 + 1, and initially all are false.n := size of tpfor i in range 0 to n – 1hr := the hour part from the timemin := minute part of the stringtime := hr * 60 + minif ok[time] is true, then return ... Read More
16K+ Views
Python can handle any requirement in data manipulation through its wide variety of libraries and methods. When we need to generate all the numbers between a pair of given numbers, we can use python’s inbuilt functions as well as some of the libraries. This article describes such approaches.Using rangeThe range() function returns a sequence of numbers, starting from 0 by default, and increments by 1 ending at a specified number. We can of curse change the starting, ending as well as increment steps to suit our need.Example Live Demodef getnums(s, e, i): return list(range(s, e, i)) # Driver Code ... Read More
2K+ Views
Suppose we have two strings that are representing complex numbers, we have to parse them and perform complex number multiplication, then return result as a string.So if the input is like “1+-1i” and “1+-1i”, then the result will be “0+-2i”.To solve this, we will follow these steps −aa := a pair of real and imaginary of first complex numberbb := a pair of real and imaginary of second complex numberx := aa.real * bb.real – aa.img*bb.imgy := aa.real * bb.img + aa.img*bb.realreturn the string as “x+yi”Let us see the following implementation to get better understanding −Example Live Demo#include using namespace ... Read More
105 Views
In this problem, we are given a number N. Our task is to create a program to find N-th term of series 2, 12, 28, 50, 77, 112, 152, 198, …in C++.Problem Description − To find the N-th term of the series.2, 12, 28, 50, 77, 112, 152, 198, ...N termsWe will find a general for the series.Let’s take an example to understand the problem, Input − N = 6Output − 112Solution Approach:Here, the series is increasing in parabolic form, so the general term will be a quadratic equation.So, the general formula for the series isTN = 3*(N*N) + N ... Read More
132 Views
In this problem, we are given a number N. Our task is to create a program to find N-th term of series 0, 11, 28, 51, 79, 115, 156, 203, … In C++.Problem Description − To find the Nth terms of the series −0, 11, 28, 51, 79, 115, 156, 203, … N-th term.Let’s take an example to understand the problem,Input − N = 5Output − 79Solution Approach:The general formula for nth term of the series is −Tn = 3*(N*N) + 2*N - 5Program to illustrate the working of our solution,#include using namespace std; int findNTerm(int N) { int nthTerm = ( (3*N*N) + 2*N - 5); return nthTerm; } int main() { int N = 9; cout
186 Views
In this problem, we are given a number N. Our task is to create a Program to find N-th term of series 1, 3, 12, 60, 360...in C++.Given Series1, 3, 12, 60, 360, 2520 … N TermsLet’s take an example to understand the problem, Input − N = 6Output − 2520Solution Approach:The general term formula for this one is a bit tricky. So, the increase in the series values is huge. So, there can be a few possibilities factorial or exponentials. So, we will first consider factorial, and on observing we can see the growth half as half of the ... Read More
146 Views
In this tutorial, we will be discussing a program to find N-th term of series 1, 6, 17, 34, 56, 86, 121, 162, …For this, we will be provided with a number. Our task is to find the term for the given series at that particular position.Example Live Demo#include #include using namespace std; //calculating nth term of given series int nthTerm(int n) { return 3 * pow(n, 2) - 4 * n + 2; } int main() { int N = 4; cout