
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
Found 33676 Articles for Programming

903 Views
Suppose we have three angles. We have to check whether it is possible to create a triangle of positive area with these angles or not.So, if the input is like a = 40 b = 120 c = 20, then the output will be True as the sum of 40 + 120 + 20 = 180.To solve this, we will follow these steps −if a, b and c are not 0 and (a + b + c) is same as 180, thenif (a + b) >= c or (b + c) >= a or (a + c) >= b, thenreturn ... Read More

527 Views
Suppose we have two lowercase strings s and t. Sometimes, when we type a vowel, the key might get long pressed, and the vowel will be repeated 1 or more times. We have to check whether it is possible that t is typed that indicates s or not.So, if the input is like s = "mine" t = "miiine", then the output will be True as vowel 'i' is repeated three times, other letters are fine.To solve this, we will follow these steps −s_len := size of st_len := size of tj := 0for i in range 0 to s_len ... Read More

440 Views
Suppose we have two strings s and t. We have to check whether s is suffix of t or not.So, if the input is like s = "ate" t = "unfortunate", then the output will be True.To solve this, we will follow these steps −s_len := size of st_len := size of tif s_len > t_len, thenreturn Falsefor i in range 0 to s_len, doif s[s_len - i - 1] is not same as t[t_len - i - 1], thenreturn Falsereturn TrueLet us see the following implementation to get better understanding −Example Live Demodef solve(s, t): s_len = len(s) ... Read More

9K+ Views
Suppose we have a string s. We have to check whether the given string is a palindrome or not. We have to solve this problem using pointers in C.So, if the input is like s = "racecar", then the output will be True.To solve this, we will follow these steps −length := size of stringforward := pointing to the first character of stringreverse := pointing to the last character of stringwhile position of reverse >= position of forward, doif character pointed by reverse is same as character pointed by forward, thenincrease forward and decrease reverse by 1otherwisecome out from loopif ... Read More

2K+ Views
Suppose we have a string s. We have to check whether the given string is isogram or not. The isogram is a string where the occurrence of each letter is exactly one.So, if the input is like s = "education", then the output will be True because all characters in "education" occurs exactly once.To solve this, we will follow these steps −char_list := a new listfor each char in word, doif char is non numeric, thenif char is in char_list, thenreturn Falseinsert char at the end of char_listreturn TrueLet us see the following implementation to get better understanding −Example Live Demodef ... Read More

393 Views
Suppose we have a string s. We have to check whether the given string is colindrome or not. The colindrome is a concatenated string of 6 length palindromes.So, if the input is like s = "aabbaamnoonm", then the output will be True as this contains palindromes like "aabbaa" and "mnoonm", both are of length 6.To solve this, we will follow these steps −if size of s is not multiple of 6, thenreturn Falsefor i in range 0 to size of s - 1, increase by 6, doif s[from index i to i+5] is not palindrome, thenreturn Falsereturn TrueLet us see ... Read More

567 Views
Suppose we have a binary string s and another value m, we have to check whether the string has m consecutive 1’s or m consecutive 0’s.So, if the input is like s = "1110111000111", m = 3, then the output will be True as there are three consecutive 0s and 1s.To solve this, we will follow these steps −str_size := size of scount_0 := 0, count_1 := 0for i in range 0 to str_size - 2, doif s[i] is same as '0', thencount_1 := 0count_0 := count_0 + 1otherwise, count_0 := 0count_1 := count_1 + 1if count_0 is same as ... Read More

210 Views
Suppose we have a lowercase string s, we have to check whether we can convert s into a valid string by deleting at most 1 character. Here a valid string means a string str such that for all unique characters in str each character’s frequency is same.So, if the input is like s = "xyyzx", then the output will be True as we can delete z then string will be "xyyx" where occurrences of x and y are same.To solve this, we will follow these steps −size := 26occurrence := an array of size 26. This is storing frequencies of ... Read More

223 Views
Suppose we have a string s we have to check whether the string is following the pattern a^nb^n or not. This is actually a string when n = 3, the string will be "aaabbb".So, if the input is like s = "aaaaabbbbb", then the output will be True as this follows a^5b^5.To solve this, we will follow these steps −size := size of sfor i in range 0 to size - 1, doif s[i] is not same as 'a', thencome out from loopif i * 2 is not same as size, thenreturn Falsefor j in range i to size - ... Read More

395 Views
Suppose we have a string s. We have to check whether this string contains some even length palindrome or not.So, if the input is like s = "afternoon", then the output will be True as "afternoon" has even length palindrome "noon".To solve this, we will follow these steps:for i in range 0 to size of string - 1, doif string[i] is same as string[i + 1], thenreturn Truereturn FalseLet us see the following implementation to get better understanding −Example Live Demodef solve(string): for i in range (0, len(string)): if (string[i] == string[i + 1]): ... Read More