Swift 4 Tutorial : Dictionary

Dictionary in swift : Dictionaries are Collection that store key-value paired items.The values are of same type and all items are stored without any order. You can access any item using its key. It is not required that the keys should be a number always. All the keys should be of the same type and

Find ASCII value of a Character in Java

Write a program in Java to find ASCII value of a Character : ASCII or American Standard Code for Information Interchange is a character encoding standard to represent characters in computers. By using a 7 bit binary number, a character is defined. There are 128 possible characters . In decimal form, we can reprent a

What is Docstring and how to write docsrting in python

Docstring in python : A docstring is a string that is used for documentation of a module,function,class or method in python. This string comes as the first statement after the name of the function , module etc . The value of a docstring can be printed out by using _doc_ attribute of the object. So,

Python Program to find if a number is Armstrong or not

Find if a number is Armstrong or not using python : A three digit number is called a Armstrong number if the sum of cube of its digits is equal to the number itself. 407 is an Armstrong number since 4**3 + 0**3 + 7**3 = 407 For a number with ‘n’ digits, the power

Write a Java program to find current resolution of the Screen

Java program to find current Screen Resolution : In this tutorial, we will learn how to find the Screen resolution of your system. We will use ‘java.awt’ package to calculate the values. 1. Using ‘Toolkit’ class, get the screen size using ‘Toolkit.getDefaultToolkit().getScreenSize()’ method. 2. ‘getScreenSize()’ gets the size of the primary display if multiple screens

Find the most frequent element in an array using Java

Write a Java program to Find the most frequent element in an array: Most frequent element means the element that occurs most of the time in an array. To find the most frequent element, follow these steps : 1. We are using a ‘map’ to store count of each element in the given array 2.

Java program to find pairs with a given sum in an array

Java program to find pairs with a given sum in an array : Problem : One array is given with unsorted numbers. Find number of pairs of elements the sum of which is equal to a given value : Solution : 1. We will scan the array two times. 2. Create one empty HashMap first

Java 8 Tutorial : StringJoiner example

StringJoiner class in Java8 explaination with Example : ‘StringJoiner’ class was introduced in Java8 . Using this class, we can join a number of different strings easily. Two different constructs are available for ‘StringJoiner’ to instantiate it. StringJoiner(CharSequence delimiter) : It constructs a StringJoiner with the separator as ‘delimiter’. StringJoiner(CharSequence delimiter, CharSequence p, CharSequence s)