- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 34734 Articles for Programming
579 Views
Here two lists are given. Our task is to check and found weather two given lists are circularly identical or not. Example Input : A = [100, 100, 10, 10, 100] B = [100, 100, 100, 10, 10] Output : True Explanation True as when these elements in the list will circularly rotate then they would be similar to other given list Algorithm Step 1: Create First and Second List. Step 2: Then Lists are converted to map. Step 3: join () method is used for converting the ... Read More
3K+ Views
A prime number is a whole number that is greater than one and the only factors of a prime number should be one and itself. Some of the first prime numbers are −2, 3, 5, 7, 11, 13 ,17The program to check if a number is prime or not is as follows.Example Live Demo#include using namespace std; int main() { int n=17, i, flag = 0; for(i=2; i
10K+ Views
Factors are those numbers that are multiplied to get a number.For example: 5 and 3 are factors of 15 as 5*3=15. Similarly other factors of 15 are 1 and 15 as 15*1=15.The program to display the factors of a number are given as follows.Example Live Demo#include using namespace std; int main() { int num = 20, i; cout
2K+ Views
List is a built-in data structure in python which functions like a dynamically sized array. Lists are created by putting elements in square brackets ‘[element 1, element 2, ….]’. Elements present in list are indexed and the indexing starts from [0]. List has the following properties − List is mutable meaning that elements can be added, removed or changed from a list after its creation. List is ordered, so adding new elements to the list will not change the order of existing elements. List allows for entry of duplicate elements since each element has a unique index. A single ... Read More
14K+ Views
The fibonacci series contains numbers in which each term is the sum of the previous two terms. This creates the following integer sequence −0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377…….The recurrence relation that defines the fibonacci numbers is as follows −F(n) = F(n-1) + F(n-2) F(0)=0 F(1)=1Programs to Display Fibonacci SeriesThere are two methods to display fibonacci series i.e. using dynamic programming and recursive programming. These are further explained as follows −Dynamic ProgrammingExample#include using namespace std; void fib(int n) { int f[n]; int i; f[0] = 0; f[1] ... Read More
13K+ Views
C++ is a general purpose programming language that supports procedural, object-oriented and generic programming. C++ is a superset of C and all valid C programs are valid in C++ as well.C++ supports object oriented programming with features such as data hiding, encapsulation, inheritance, polymorphism etc.Let us see the first C++ program that prints Hello, World!.Example#include using namespace std; int main() { cout
1K+ Views
This article will demonstrate how write a Python program to sort a tuple (made up of float elements) using its float elements. Here, we'll look at both how to sort using the in-built sorted() function and how to sort using the in-place method of sorting. Input-Output Scenarios Following is an input and its output scenario determining the sorting of a tuple by its float element − Scenario-1 Input: tuple = [(‘Dengu’, ’54.865’), (‘Malaria’, ‘345.743’), (‘Corona’, ‘456.864’), (‘Typhoid’, ‘35.285’), (‘Jaundice’, ’83.367’)] Output: [(‘Corona’, ‘456.864’), (‘Malaria’, ‘345.743’), (‘Jaundice’, ’83.367’), (‘Dengu’, ’54.865’), (‘Typhoid’, ‘35.285’)] In the above scenario we can see that ... Read More
354 Views
One n×n user input integer matrix is given and the value of k. Our task is to find out k'th smallest element in a 2D array. Here we use heapq mudule.Heap queue (or heapq) in Python. In Python, it is available using “heapq” module. The technique of this module in python is that each time the smallest of heap element is popped (min heap).nsmallest () method is used to get n least values from a data frame or a series. Example Input Array is:: 10 20 20 40 15 45 40 30 32 33 30 50 ... Read More
639 Views
String is given. String contains only digit. Our task is to check all possible valid IP address combinations. Here first we check the length of the string then split by ".". Then we check the different combination of ".". Example Input : "255011123222" It's not a valid IP address. Input : 255011345890 Valid IP address is 255.011.123.222 Algorithm Step 1: First check the length of the string. Step 2: Split the string by ".". We will place 3 dots in the given string. W, X, Y, and Z are numbers from 0-255 the numbers cannot be ... Read More
3K+ Views
This article teaches you how to write a python program to find mirror characters in a string. Let us first understand what mirror characters in a string are. Two identical alphabetically positioned characters, one from the front and the other from the back, are known as mirror characters. For example, the alphabet a's mirror character is "z, " "b's" is "y, " and so on. Input-Output Scenario Following is an input and its output example of mirror characters in a string − Input: p = 3 Input string = Coding Output: Cowrmt Here, the alphabets “d”, “i”, “n”, “g” ... Read More
To Continue Learning Please Login
Login with Google