
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 7442 Articles for Java

775 Views
We can scroll down a webpage in Selenium using Java. Selenium is unable to handle scrolling directly. It takes the help of the Javascript Executor to perform the scrolling action up to an element.First of all, we have to locate the element up to which we have to scroll. Next, we shall use the Javascript Executor to run the Javascript commands. The method executeScript is used to run Javascript commands in Selenium. We shall take the help of the scrollIntoView method in Javascript and pass true as an argument to the method.Syntax −WebElement elm = driver.findElement(By.name("name")); ((JavascriptExecutor) driver) .executeScript("arguments[0].scrollIntoView(true);", elm);Exampleimport ... Read More

2K+ Views
Memorization is a technique based on dynamic programming which is used to improve the performance of a recursive algorithm by ensuring that the method does not run for the same set of inputs more than once by keeping a record of the results for the provided inputs(stored in an array).Memorization can be achieved by implementing top down approach of the recursive method.Let us understand this scenario with the help of basic Fibonacci example1-D MemorizationWe will be considering a recursive algorithm with only one non constant parameter (only one parameter changes its value) hence this method is called 1-D memorization. The ... Read More

180 Views
We are given with an integer array of size N(size of multiple 4) and we have to perform Xclusive OR operation on the array such that input[1- 4] resembles utility_arr[1- 4] and the conditions of computing is If arr[1 – 4] = {a1, a2, a3, a4} then q[1 – 4] = {a1 ⊕ a2 ⊕ a3, a1 ⊕ a2 ⊕ a4, a1 ⊕ a3 ⊕ a4, a2 ⊕ a3 ⊕ a4}Let us see various input output scenarios for this -In − int[] input = { 5, 2, 3, 4 };Out − Result after XOR operation 4 3 2 5Explanation −An Exclusive-OR gate's output ... Read More

333 Views
We are given two integer arrays, one having the elements which are computed and other having split points which are required to split the array for making subset and we have to calculate the sum of each subset in every split and return the maximum subset sum.Let us understand with example:-Input − int arr[] = int arr[] = { 9, 4, 5, 6, 7 } int splitPoints[] = { 0, 2, 3, 1 };Output − Maximum subarray sum after each split [22, 13, 9, 9]Explanation − Here we are breaking the array according to their split points and obtaining the maximum subset sum ... Read More

383 Views
We are provided with an array and a sum value; the problem statement is to calculate the maximum subset sum which does not exceed the given sum value. We cannot apply the brute force approach here because the structure of the given array is not the same as the divide and conquer approach.Let us see various input output scenarios for this -Let us understand with exampleInput − long arr[] = { 21, 1, 2, 45, 9, 8 } long given_Sum = 12Output −The maximum sum subset having sum less than or equal to the given sum-->12Explanation −The array is split into a set ... Read More

362 Views
We are given 5 Integer variables Num, P1, P2, profit_P1, profit_P2 and the task is to maximize the profit and from all the natural numbers in the range of [1, Num]. The approach here is that if a positive number is divisible by P1 the profit increases by profit_P1 and similarly if if the number in the range is divisible by P2 the profit margin of profit_P2 increases. Also, the profit from a positive integer can be added at most once.Let us understand with example:-Input − int num = 4, P1 = 6, P2 = 2, profit_P1 = 8, profit_P2 = ... Read More

787 Views
We are given a K number of linked lists of variable sizes which are sorted in their sequence and we have to merge the list into a resultant list in such a way that the resultant array is sorted in order and the resultant array is printed as the output to the user.Let us understand with example:-Input −int k = 3;list[0] = new Node(11);list[0].next = new Node(15);list[0].next.next = new Node(17);list[1] = new Node(2);list[1].next = new Node(3);list[1].next.next = new Node(26);list[1].next.next.next = new Node(39);list[2] = new Node(4);list[2].next = new Node(8);list[2].next.next = new Node(10);Output −The merged list is-->2>> 3>> 4>> 8>> 10>> 11>> 15>> 17>> ... Read More

258 Views
The problem statement here is to kill the goons in the rooms of a building with minimum number of bombings. The rooms are labelled as 1 to n. The goons are injured by the first bombing attack and die in the second. When the rooms are bombed the goons rush to the nearest room in the building specially the neighboring room. We must calculate the number of bombing it is required to bomb the rooms in order to kill all the goons in the building.Let us understand with exampleInput − int number of rooms = 3Output −Total Bombings required42 1 3 2Explanation − ... Read More

725 Views
We are given an ‘n’ number of arrays, let's say we take three arrays i.e. arr1[], arr2[] and arr3[] of integer type. The task is to merge all the given integer arrays in such a manner that the resultant array is sorted in the runtime only.Let us understand with exampleInput −Inta[]={21, 22, 23, 24};int b[ ] ={28, 31, 35}Output −int resultant[ ]={21, 22, 23, 24, 28, 31, 35}.Explanation − The array elements are compared before they are added and added according to their suitable position in the resultant array.Input −inta[]={1, 3, 5, 7, 9, 11, 13};int b[ ] ={14, 16, 18}int c[ ] ={19, ... Read More

1K+ Views
Given an integer n that is not negative. The goal is to reverse the bits of n and report the number that results from doing so. While reversing the bits, the actual binary form of the integer is used; no leading 0s are taken into account.Let us see various input output scenarios for thisInput − 13Output − Reverse actual bits of the given number 11(13)10 = (1101)2. After reversing the bits, we get: (1011)2 = (11)10.Explanation − The binary bits are obtained from the input number which is then reversed and finally converted to decimal format which is returned as output.Input − 18Output − ... Read More