In the case of android application development, It is the right time to switch from traditional Java language to some modern programming languages, As we know the trending and most advanced one is Kotlin. It has been declared as the official language for android application development and it has got complete support in Android SDK (Studio).
Posts
Custom WillPopScope – Flutter
The WillPopScope widget comes with the Flutter framework. It gives us control over the back button action, allowing the current page to go back to the previous one if it meets certain requirements. This is achieved using a callback, which the widget takes in as one of its parameters. How to overcome iOS limitations in Flutter willpopscope.…
Unique Email – Kotlin -Code Challenge
Problem Every valid email consists of a local name and a domain name, separated by the ‘@’ sign. Besides lowercase letters, the email may contain one or more ‘.’ or ‘+’. For example, in “alice@leetcode.com”, “alice” is the local name, and “leetcode.com” is the domain name. If you add periods ‘.’ between some characters in the local name part of an email address, mail sent there will be forwarded to the same address without dots in…
Remove Duplicate – Kotlin Solution
Problem Given the head of a sorted linked list, delete all duplicates such that each element appears only once. Return the linked list sorted as well. Example 1: Input: head = [1,1,2] Output: [1,2] Example 2: Input: head = [1,1,2,3,3] Output: [1,2,3] Solution- Kotlin fun main(args:Array<String>){ var node1=ListNode(1) var node2=ListNode(1) var node3=ListNode(2) // var node4=ListNode(3) // var node5=ListNode(3) // node4.next=node5 //…
Square root of x -Sqrt(x) – Kotlin
Problem Given a non-negative integer x, compute and return the square root of x. Since the return type is an integer, the decimal digits are truncated, and only the integer part of the result is returned. Note: You are not allowed to use any built-in exponent function or operator, such as pow(x, 0.5) or x ** 0.5. Example 1: Input: x = 4 Output: 2 Example 2: Input:…
Plus One – Code Challenge-Kotlin
Problem You are given a large integer represented as integer array digits, where each digits[i] is the ith digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading 0’s.Increment the large integer by one and return the resulting array of…
Valid Parentheses – Code Challenge- Kotlin
Problem Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. Given a string s containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[‘ and ‘]’, determine if the input string…