---
# System prepended metadata

title: Positive Grid

---

# Positive Grid

Example1:
Input: nums = [5,7,7,8,8,10], target = 8
output = 3

Example2:
Input: nums = [5,7,7,8,8,10], target = 7
output = 1

Example3:
Input: nums = [5,7,7,8,8,10], target = 11
output = -1

```java=

int index = nums.length / 2;
int output = findNum(8, nums, index);

int findNum(int target, int[] array, int index){
    int n = nums[i];
    if(n == target){
        return n;
    }
    else if (n < target) {
        int i = index / 2;
        return findNum(target, array, i);
    }
    else {
        int nextIndex = ((array.length - 1) - i) / 2
        int i = index + nextIndex;
        return findNum(target, array, i);
    }
}


```kotlin
data class Person(name: String, age: Int)

class Test {
	init {
			val a = Person("John", 23)
			val b = Person("John", 23)
			
			printf(a == b)  // ans: true
            printf(a === b) // ans: false
	}
}
```


```
var isComputed = false
val isComputedStr = isComputed

fun foo(computed: Boolean) {
    isComputed = computed
    System.out.println("isComputedStr " + isComputedStr)
}

fun main() {
    foo(true)
}

```

isComputedStr false


```kotlin=
init {
		GlobalScope.launch {
		            println(">> Thread1 = ")
		            val result = fetchMusicList()
		            when(result) {
		                is Result.Success -> {
                          // TODO: update view
                          runOnUiThread
		                is Error -> {
		                  // TODO: update view
		                }
		            }
		        }
}

suspend fun fetchMusicList(): Result<Any> {
   println(">> Thread2 = ")
   return Result.Success<Any>("test")
}
```
SignIN

Activity  

A Fragment -> account/password
B Frag -> avatar
C Frag -> personal info -> send api request

