## Program to build a DFA to accept strings that start and end with same character

Given a string consisting of characters a and b, check if the string starts and ends with the same character or not. If it does,… Read More »

Given a string consisting of characters a and b, check if the string starts and ends with the same character or not. If it does,… Read More »

Given a number N, the task is to find the Nth term in series 2, 3, 10, 15, 26…. Example: Input: N = 2 Output:… Read More »

Given a number N, the task is to find the Nth term in series 12, 35, 81, 173, 357, … Example: Input: N = 2… Read More »

Given a number N, the task is to find the N-th term in series 4, 2, 2, 3, 6, … Example: Input: N = 2… Read More »

Prerequisite: Deterministic Finite Automata Given a string str consists of characters ‘a’ & ‘b’. The task is to check whether string str starts and ends… Read More »

DFA or Deterministic Finite Automata is a finite state machine which accepts a string(under some specific condition) if it reaches a final state, otherwise rejects… Read More »

Given two integers A and B, the task is to calculate the number of pairs (a, b) such that 1 ≤ a ≤ A, 1… Read More »

Given a number n and a value k, the task is to find the smallest m(m>=n), such that m can be represented as a sum… Read More »

Given a sorted array arr[] of length N and an integer K such that K < N, the task is to remove exactly K elements… Read More »

Given an array of positive distinct integers arr[], the task is to find the final number obtained by performing the following operation on the elements… Read More »

Given a binary string str of length N, the task is to find the maximum count of substrings str can be divided into such that… Read More »

Given a string str, the task is to check whether all the substrings of length ≥ 2 have the number of vowels at least as… Read More »

Given an array arr[] of N elements, the task is to find the count of triplets (arr[i], arr[j], arr[k]) such that (arr[i] + arr[j] +… Read More »

Given an array arr[] of N integers, the task is to find and print the Longest Increasing Subsequence. Examples: Input: arr[] = {12, 34, 1,… Read More »

Given a number represented as a string str consisting of the digit 1 only i.e. 1, 11, 111, …. The task is to find the… Read More »