Curated List of Real-time Android Interview Questions. Help fellow developers by contributing to these interview Questions - Create a pull request in Github.
Quick Jump to Topics:
Quick Jump to Topics:
fun main(args: Array<String>) { | |
val list = ArrayList(readLine()!!.split(" ").map { it.toInt() }) | |
selection(list) | |
for(i in list) println(i) | |
} | |
fun selection(a: ArrayList<Int>) { | |
var min:Int | |
for (i in 0 until a.size) { | |
min = i |
package main.dataStructures.sorting | |
fun main(args: Array<String>) { | |
val array = readLine()!!.split(" ").map { it.toInt() }.toIntArray() // 1) Read the input and split into array | |
mergeSort(array) | |
for(i in array) println(i) | |
} | |
fun mergeSort(array : IntArray, helper:IntArray = IntArray(array.size), low:Int = 0, high : Int = array.size-1) { | |
if(low < high) { |
package main.dataStructures.sorting | |
fun main(args: Array<String>) { | |
var numSwaps = 0 | |
var isSorted = false | |
val str = readLine()!! | |
val intList: ArrayList<Int> = ArrayList(str.split(" ").map { it.toInt() }) //1) read values and convert them to arraylist | |
var lastUnsorted = intList.size - 1 // 2) to keep the track of unsorted array |
package main.dataStructures.sorting | |
fun main(args: Array<String>) { | |
val array = readLine()!!.split(" ").map { it.toInt() }.toIntArray() // 1) Read the input and split into array | |
quickSort(array, 0, array.size-1) | |
for(i in array) println(i) | |
} | |
fun quickSort(array: IntArray, left: Int, right: Int) { | |
val index = partition (array, left, right) |
public class RetainFragEgActivity extends Activity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_my); | |
Button b = (Button) findViewById(R.id.aaa); | |
b.setOnClickListener(new View.OnClickListener() { | |
@Override public void onClick(View v) { |
package main.interview.hacklandelection | |
import com.sun.xml.internal.fastinfoset.util.StringArray | |
import java.util.* | |
fun main() { | |
val list = StringArray() | |
var iter = readLine()!!.toInt() | |
while(iter-- > 0) { | |
list.add(readLine()!!) |
package main.algorithms.searching | |
fun main(args: Array<String>) { | |
val input = readLine()!!.trim().split(" ").map { it -> it.toInt() }.toIntArray() // to read an array (from user input) | |
val eleToSearch = readLine()!!.trim().toInt() // to read the element to be searched (from user input) | |
val pos = binarySearchIterative(input, eleToSearch) | |
if(pos >= 0 ) { | |
println(pos) // to print position at last | |
} else { | |
println("Position not found") |
package main.algorithms.searching | |
fun main(args: Array<String>) { | |
val input = readLine()!!.trim().split(" ").map { it -> it.toInt() }.toIntArray() // to read an array (from user input) | |
val eleToSearch = readLine()!!.trim().toInt() // to read the element to be searched (from user input) | |
val pos = binarySearchRecursive(input, eleToSearch, 0, input.size -1) | |
if(pos >= 0 ) { | |
println(pos) // to print position at last | |
} else { | |
println("Position not found") |
package com.coderefer.rxandroidexamples.intro.operators.create | |
import android.support.v7.app.AppCompatActivity | |
import android.os.Bundle | |
import android.util.Log | |
import com.coderefer.rxandroidexamples.R | |
import io.reactivex.Observable | |
import io.reactivex.Observer | |
import io.reactivex.disposables.Disposable |