Sudhir sharma has Published 1149 Articles

Find if array has an element whose value is half of array sum in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 13:53:43

189 Views

In this problem, we are given an array arr of sorted unique values. Our task is to find if array has an element whose value is half of array sum. Problem Description: For the array arr[], we need to find element x in the array such that the sum of all elements ... Read More

Find if a string starts and ends with another given string in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 13:53:31

547 Views

In this problem, we are given two strings str and corStr. Our task is to find if a string starts and ends with another given string. Let’s take an example to understand the problem, Input: str = “abcprogrammingabc” conStr = “abc”Output: TrueSolution Approach: To solve the problem, we need to check if the string ... Read More

Find if a number is divisible by every number in a list in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 13:53:18

282 Views

In this problem, we are given a list of n numbers and a number. Our task is to find if a number is divisible by every number in a list. We need to check if the given number divides all elements of the list or not.Let’s take an example to understand ... Read More

File opening modes(r versus r+) in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 13:49:44

3K+ Views

File handling in programming languages is very important for the interaction of programming with the memory for accessing files and fetching data in it.Using a program, you can read data from a file as well as write data to the file and do a lot more functions.Here, we will see reading ... Read More

Find Height of Binary Tree represented by Parent array in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 13:48:56

209 Views

In this problem, we are given an array arr[] of size n that denotes a tree. Our task is to find height of Binary Tree represented by Parent array. A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −The value of the key ... Read More

Fermat's little theorem in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 13:45:58

792 Views

Fermat’s little theorem −This theorem states that for any prime number p,           Ap - p is a multiple of p.This statement in modular arithmetic is denoted as,                  ap  ≡ a (mod p)If a is not divisible by p then,  ap ... Read More

File globbing in Linux in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 13:45:44

710 Views

p>File globbing also known as Path Name Expansion. It is the method of recognizing wildcard patterns in linux and  then finding the file path expansion based on these patterns.Wildcard Patterns are strings that are used for selection of multiple files based on patterns.The character patterns like “?” , “[ ]” , “*” are ... Read More

Fifth root of a number in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 13:45:29

1K+ Views

In this problem, we are given a number N. Our task is to find the floor value of the fifth root of a number.Fifth Root of a number is the number which when multiplied to itself 5 times returns the number.If N1/5 = a then, a*a*a*a*a = N.Let’s take an example ... Read More

Fill array with 1's using minimum iterations of filling neighbors in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 13:45:26

199 Views

 In this problem, we are given an array arr consisting of n elements that are either 0 or 1. Our task is to fill array with 1’s using minimum iterations of filling neighbors. Let’s take an example to understand the problem, Input: arr[] = {0, 1, 1, 0, 0, 1}Output: 1Solution Approach −To ... Read More

Fermat's Last Theorem in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2021 13:33:04

234 Views

Fermat’s last theorem in number theory also known as Fermet’s conjecture is a theorem that states that for power n greater than 2. No three values a, b, c satisfy −          an + bn = cni.e.     if n 32 + 42 = 9 + 16 = 25 ... Read More

Advertisements