Dev Prakash Sharma has Published 556 Articles

Find the index of the first unique character in a given string using C++

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 05-Feb-2021 12:07:52

2K+ Views

Given a string ‘s’, the task is to find the first unique character which is not repeating in the given string of characters and return its index as output. If there are no such characters present in the given string, we will return ‘-1’ as output. For example, Input-1 −s ... Read More

Detect Capital in a given string using C++

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 05-Feb-2021 12:07:22

419 Views

Let's suppose we have a string ‘str’ which consists of some character in it. The task is to check whether the given string has all its characters capitalized or not and return True or False respectively. For example, Input-1 −str = “INDIA”Output −TrueExplanation − Since all the character of the ... Read More

Delete a tail node from the given singly Linked List using C++

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 05-Feb-2021 12:06:46

2K+ Views

A Linked List is a linear Data Structure that contains nodes and each node has two fields; one is the value or data to be inserted and the other field stores the address of the next node.Our task here is to delete a node from the end of a Linked ... Read More

Write a program in C++ to count the Number of substrings that starts with ‘1’ and ends with ‘1’

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 05-Feb-2021 11:59:57

329 Views

Let’s suppose we have given a length of string ‘str’ and a string. The task is to count the number of substrings that starts with ‘1’ and ends with ‘1’ in a given Binary String. A Binary String contains ‘1’ and ‘0’ only. For example, Input-1 −N = 5 str ... Read More

Write a program in Python to count the number of digits in a given number N

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 05-Feb-2021 11:58:55

6K+ Views

Let's suppose we have given a number N. the task is to find the total number of digits present in the number. For example, Input-1 −N = 891452Output −6Explanation − Since the given number 891452 contains 6 digits, we will return ‘6’ in this case.Input-2 −N = 0074515Output −5Explanation − Since ... Read More

Count Good Meals in Python

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 05-Feb-2021 11:58:15

239 Views

A good meal contains exactly two different food items with a sum of deliciousness equal to a power of two. You can pick any two different foods to make a good meal.Let us suppose we have given an array of integers arr where arr[i] is the deliciousness of the ith ... Read More

Write a program in JavaScript to check if two strings are anagrams of each other or not

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 05-Feb-2021 11:57:40

19K+ Views

Given two strings ‘a’ and string ‘b’, we have to check if they are anagrams of each other or not and return True/False. For example, Input-1 −String a= “india” String b= “nidia”Output −TrueExplanation − Since the given string ‘b’ contains all the characters in the string ‘a’ thus we will ... Read More

Write a program in Java to check if a string can be obtained by rotating another string by 2 places

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 05-Feb-2021 11:56:59

747 Views

Suppose we’ve two strings ‘a’ and ‘b’, the task is to find whether we can obtain string ‘b’ by rotating string ‘a’ exactly by 2 places in an anticlockwise or clockwise direction. For example, Input-1 −a = google b = legoogOutput −TrueExplanation − String ‘google’ can be rotated in an ... Read More

Write a program in C++ to check if a string can be obtained by rotating another string by two places

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 05-Feb-2021 11:55:51

383 Views

Suppose we’ve given two strings ‘a’ and ‘b’, the task is to find whether we can obtain the string ‘b’ by rotating string ‘a’ exactly by two places in an anticlockwise or clockwise direction. For example, Input-1 −a = google b = legoogOutput −TrueExplanation − String ‘google’ can be rotated ... Read More

C++ Program to Delete the First Node in a given Singly Linked List

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 05-Feb-2021 11:54:11

8K+ Views

A linked list is a linear data structure that has multiple nodes that are connected with each other. Each node consists of two fields – Data Field and the address of the next node.Let us assume we have a singly linked list and we need to delete the first node ... Read More

Advertisements