Java code for generating your text into QR code


Do the following steps to achieve,

1) Create a new java project using any IDE( Notepad, Eclipse, Netbeans, Visual Studio Code, etc,.. ) 
2) Next, use the most powerful weapon of developers with the following code.






3) Add the following jar files to your application classpath.
4) Run the project as Java application. That's it.


Click here for source code

Output







Three color sort


Given a linear integer array (which has only 0s, 1s, 2s) in unsorted fashion, you need to sort that array with very minimal swaps and visit to the node. public class Answer implements ThreeColorSortInterface { @Override public void PerformThreeColorSort(ColorArray colArray) { // WRITE YOUR CODE HERE return ; } public static void main(String [] args) { // write code here to test } } Here is the ColorArray.java class (only for reference). public class ColorArray { private int[] mArr; private int mSize; public ColorArray(int [] arr, int size){ this.mArr = arr; this.mSize = size; } public int GetSize(){ return this.mSize; } public int GetColor(int index){ if(index <0 || index >= this.mSize) return -1; return this.mArr[index]; } // return true on successful swap public boolean Swap(int index1, int index2){ if(index1 <0 || index1 >= this.mSize) return false; if(index2 <0 || index2 >= this.mSize) return false; int temp = this.mArr[index1]; this.mArr[index1] = this.mArr[index2]; this.mArr[index2] = temp; return true; } } Example1: Input: {0, 1, 1, 0, 2} Output:{0, 0, 1, 1, 2} Example2: Input: {2,2,1,1,0,0,1,1,2,2} Output:{0,0,1,1,1,1,2,2,2,2}

Answer

Swap every two nodes in a single linked list


Write code to swap every two nodes in a single linked list. Example: Input: 2 -> 3 -> 31 -> 21 -> 5 Output: 3 -> 2 -> 21 -> 31 -> 5 public class Answer implements SwapEveryTwoNodesInLinkedListInterface{ @Override public Node SwapEveryTwoNodesInLinkedList(Node head) { // WRTIE YOUR CODE HERE return ; } } // Here is the Node.java public class Node { public int nodeValue; public Node nextNode; }

Answer

Base2 number system conversion


Given a number, you need to return a string which has the base 2 representation. Dont use any built-in methods to convert public class Answer implements Base2SystemInterface { @Override public String GetBase2System(int num) { // WRITE YOUR CODE HERE return ; } public static void main(String [] args) { // write code here to test } } Example1: Input: 6 Output:"110" Example2: Input: 16 Output:"10000"

Answer

Reverse words in a line


Given a string reverse the words in that line. public class Answer implements ReverseStringInLineInterface { @Override public String PerformReverseStringInLine(String str) { // WRITE YOUR CODE HERE return ; } public static void main(String [] args) { // write code here to test } } Example1: Input: "Hello World" Output:"World Hello" Example2: Input: "A B C" Output:"C B A"

Answer

Next immediate greatest number which has all the digits

Given a integer, find the next immediate greatest number which has all the digits in the given number public class Answer implements NextLargeNumberInterface { @Override public int GetNextLargeNumber(int num) { // WRITE YOUR CODE HERE return ; } public static void main(String [] args) { // write code here to test } } Example1: Input: 2586 Output:2658 Example2: Input: 469 Output:496

Answer

Run length encoding of a string

Given a string, you need to count the consecutive characters and show the count in the string for each character. If there is only one character, you dont need to show the count. public class Answer implements RunLengthEncodingInterface { @Override public String DoRunLengthEncoding(String str) { // WRITE YOUR CODE HERE return ; } public static void main(String [] args) { // write code here to test } } Example1: Input: "aaaabbbcddddaa" Output:"a4b3cd4a2"

Answer