Leet Code problem 1410: – HTML Entity Parser

HTML entity parser is the parser that takes HTML code as input and replace all the entities of the special characters by the characters itself. The special characters and their entities for HTML are: Given the input text string to the HTML parser, you have to implement the entity parser. Return the text after replacing…

Any other way we can enter the input data in a text Box other than using sendKeys() methods in Selenium WebDriver?

Ans:- This is very frequently asked by the interviewer to check whether you are aware about the JavaScriptExecutor interface or not. Using javaScriptExecutor we can enter the input data in a text box. The code is mentioned below:- Code:- Explanation of the source code (Here source code snip added for better understanding):- JavaScriptExecutor is an…

How to access the collection elements using the streams?

Streams is introduced in java8 version. It basically helps to write a concise piece of code and it’s functional style of code writing. For the complete piece of code please visit the below mentioned link. The piece of code for stream iteration is mentioned below :- In the above case the “forEach” is a terminal…

How to access collection elements in java using iterator method?

Iterator is a method which returns an iterator over elements. It is defined inside the “Iterable” interface of java collection framework. The source code of this interface can be found in the below mentioned link. Let’s create on collection of hotels as mentioned in the below mentioned code:- The source code of the “Hotel” class…

leetcode solution of problem “Two Sum”

Two Sum Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. This problem is…

Leetcode solution of problem 217 in java

Contains Duplicate Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. The above problem is taken from the below mentioned link:- Leetcode Problem Approach:- Use of HashSet data structure will solve the problem. Here Set is chosen as it…

Leetcode 1290 solution in java

Convert Binary Number in a Linked List to Integer Given head which is a reference node to a singly-linked list. The value of each node in the linked list is either 0 or 1. The linked list holds the binary representation of a number. Return the decimal value of the number in the linked list. The problem is…

lambda examples in java language with code

Lambda expression is used for the implementation of the functional interfaces. Functional interface is those interfaces which has only one abstract method. We can declare an interface as functional interface by using the annotation @FunctionalInterface. e.g. Comparator interface in java is a functional interface. Please visit the official site for more information:- lambdaexpressions Example 1:-…