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
Programming Articles - Page 1967 of 3366
510 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
470 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
104 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
131 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
185 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
144 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
173 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, 9, 22, 39, 60, 85, 114, 147, …in C++.Problem Description − We are given the Series −0, 9, 22, 39, 60, 85, 114, 147, ....NtermsTo find the Nth term of this series, we will formula the general term of the series and then find the Nth term.Let’s take an example to understand the problem, Input − N = 6Output − 85Solution Approach:To find the general term of the series. Let’s observe the growth of the values of ... Read More
179 Views
In this tutorial, we will be discussing a program to find N-th term of series 0, 10, 30, 60, 99, 150, 210, 280...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 series int nthTerm(int n) { return 5 * pow(n, 2) - 5 * n; } int main() { int N = 4; cout