This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun sockMerchant(n: Int, ar: Array<Int>): Int { | |
| val mapval = ar.groupBy { it }.mapValues { it.value.count() } | |
| var sock_count = 0 | |
| for (u in mapval) { | |
| if (u.value >= 2) { | |
| sock_count += u.value / 2 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution { | |
| fun findNumbers(nums: IntArray): Int { | |
| var count = 0 | |
| for (u in nums) { | |
| val numlength = u.toString().length | |
| if (numlength % 2 == 0) count++ | |
| } | |
| return count | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution { | |
| fun findMaxConsecutiveOnes(nums: IntArray): Int { | |
| var current = 0 | |
| var largest = 0 | |
| for (u in nums) { | |
| if (u == 0) { | |
| current = 0 | |
| } else { | |
| current++ | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| The following assertion was thrown during a scheduler callback: | |
| There are multiple heroes that share the same tag within a subtree. | |
| Within each subtree for which heroes are to be animated (i.e. a PageRoute subtree), each Hero must have a unique non-null tag. | |
| In this case, multiple heroes had the following tag: Test | |
| Here is the subtree for one of the offending heroes: Hero |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| fun BoxExample() { | |
| Box(Modifier.fillMaxSize()) { | |
| Text("This is first text", modifier = Modifier.align(Alignment.TopCenter)) | |
| Box( | |
| Modifier.align(Alignment.TopCenter).fillMaxHeight().preferredWidth( | |
| 50.dp | |
| ).background( Color.Blue) | |
| ) | |
| Text("This is second text", modifier = Modifier.align(Alignment.Center)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| fun TextFieldDemo() { | |
| val textState = remember { mutableStateOf(TextFieldValue()) } | |
| TextField( | |
| value = textState.value, | |
| onValueChange = { textState.value = it } | |
| ) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| fun TextExample() { | |
| Text { | |
| Text("Hello World!") | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| fun ColumnExample() { | |
| Column { | |
| Text("Hello World!") | |
| Text("Hello World!2") | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val ty=packageManager.getLaunchIntentForPackage("com.andelasurvey.smithnwokocha.newtestme") | |
| startActivity(ty) |
NewerOlder