
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

504 Views
Suppose we have a number n. We have to check whether we can create an alphabetical lowercase string from that number and check whether the string is palindrome or not. Here we will take only characters from a to j, [a = 0, b = 1... j = 9]. So if the number is 42 the substring "ec" will be printed till 6 (4+2) characters "ececec" then check this is palindrome or not.So, if the input is like n = 43, then the output will be True the string is "ededede" and this is palindrome.To solve this, we will follow ... Read More

206 Views
Suppose we have two strings s and t with only three characters 'A', 'B' and '#'. We have to check whether it is possible to convert s into t by performing these operations on s.'A' can move only to the left hand side'B' can move only to the right hand sideNeither 'A' nor 'B' can cross each otherSo, if the input is like s = "##AB##B" t = "A###B#B", then the output will be True as in s A can move easily to the left most position, and middle B can move one step to the rightTo solve this, we ... Read More

465 Views
Suppose we have an array called nums and another value sum. We have to check whether it is possible to get sum by adding elements present in nums, we may pick a single element multiple times.So, if the input is like nums = [2, 3, 5] sum = 28, then the output will be True as we can get 26 by using 5 + 5 + 5 + 5 + 3 + 3 + 2To solve this, we will follow these steps −MAX := 1000table := an array of size MAX ad fill with 0Define a function util() . This ... Read More

13K+ Views
BeautifulSoup is a third party Python library that is used to parse data from web pages. It helps in web scraping, which is a process of extracting, using, and manipulating the data from different resources.Web scraping can also be used to extract data for research purposes, understand/compare market trends, perform SEO monitoring, and so on.The below line can be run to install BeautifulSoup on Windows −pip install beautifulsoup4Following is an example −Examplefrom bs4 import BeautifulSoup import requests url = "https://en.wikipedia.org/wiki/Algorithm" req = requests.get(url) soup = BeautifulSoup(req.text, "html.parser") print("The href links are :") for link in soup.find_all('a'): print(link.get('href'))OutputThe href links ... Read More

351 Views
Suppose we have a string s, we have to check whether we can split it into four sub-strings such that each of them are non-empty and unique.So, if the input is like s = "helloworld", then the output will be True as one of the possible set of sub-strings are ["hel", "lo", "wor", "ld"]To solve this, we will follow these steps −if size of s >= 10, thenreturn Truefor i in range 1 to size of s - 1, dofor j in range i + 1 to size of s - 1, dofor k in range j + 1 to ... Read More

323 Views
BeautifulSoup is a third party Python library that is used to parse data from web pages. It helps in web scraping, which is a process of extracting, using, and manipulating the data from different resources.Web scraping can also be used to extract data for research purposes, understand/compare market trends, perform SEO monitoring, and so on.The below line can be run to install BeautifulSoup on Windows −pip install beautifulsoup4Let us see an example −Exampleimport requests from bs4 import BeautifulSoup from urllib.request import urlopen import urllib url = 'https://en.wikipedia.org/wiki/Algorithm' html = urlopen(url).read() print("Reading the webpage...") soup = BeautifulSoup(html, features="html.parser") print("Parsing the webpage...") ... Read More

8K+ Views
Suppose we have a number n. We have to check whether the number n is perfect square or not. A number is said to be a perfect square number when its square root is an integer.So, if the input is like n = 36, then the output will be True as 36 = 6*6.To solve this, we will follow these steps −sq_root := integer part of (square root of n)return true when sq_root^2 is same as n otherwise falseExampleLet us see the following implementation to get better understanding − Live Demofrom math import sqrt def solve(n): sq_root = int(sqrt(n)) ... Read More

897 Views
BeautifulSoup is a third party Python library that is used to parse data from web pages. It helps in web scraping, which is a process of extracting, using, and manipulating the data from different resources. Also, it helps the developers in Natural Language Processing applications, helps analyse data, and extract meaning insights from it.Natural Language Processing, or NLP is a part of Machine Learning that deals with text data and ways of pre-processing it to supply it as input to a Machine Learning problem.Web scraping can also be used to extract data for research purposes, understand/compare market trends, perform SEO ... Read More

1K+ Views
Suppose we have a number n. We have to check whether n is an Emirp number or not. We all know Emirp number is (letters of prime in backward direction) is a prime number that results in a different prime when its digits are reversed.So, if the input is like n = 97, then the output will be True as the reverse of 97 is 79 which is another prime.To solve this, we will follow these steps −if num is not prime, thenreturn Falsereverse_num := reverse of numreturn true when reverse_num is prime otherwise falseExampleLet us see the following implementation ... Read More

178 Views
Suppose we a number n and another value x, we have to check whether it is a power of x or not, where x is a number power of 2.So, if the input is like n = 32768 x = 32, then the output will be True as n is x^3.To solve this, we will follow these steps −From the main method do the following −cnt := 0if n is not 0 and (n AND (n - 1)) is same as 0, thenwhile n > 1, don = n/2cnt := cnt + 1return cnt mod (log c base 2) is ... Read More