Skip to content

Instantly share code, notes, and snippets.

@akvus
akvus / valid_palindrome_kotlin.kt
Last active August 19, 2022 14:44
Valid Palindrome - Kotlin
class Solution {
fun isLowerAlphaNum( ch1: Char): Boolean {
return (ch1 >= 'a' && ch1 <= 'z') || (ch1 >= '0' && ch1 <= '9')
}
fun isPalindrome(s: String): Boolean {
if (s.count() < 2) return true
val input = s.toLowerCase()
var i = 0
class Solution {
fun hasCycle(head: ListNode?): Boolean {
var first: ListNode? = head
var second: ListNode? = head
while(first != null && first.next != null) {
first = first?.next?.next
second = second?.next
if(first == second) return true
}
@akvus
akvus / two_sum.kt
Created August 30, 2022 10:04
Leetcode 2sum
fun twoSum(nums: IntArray, target: Int): IntArray {
val rests = hashMapOf<Int, Int>()
for ((i, v) in nums.withIndex()) {
val rest = target - v
if (rests.containsKey(rest)) {
return intArrayOf(i, rests[rest]!!)
}
rests[v] = i
}
@akvus
akvus / AddToSiriButton.swift
Created December 22, 2022 19:43
AddToSiriButton.swift
import Flutter
import UIKit
import IntentsUI
import Intents
class AddToSiriButtonViewFactory: NSObject, FlutterPlatformViewFactory {
private var messenger: FlutterBinaryMessenger
init(messenger: FlutterBinaryMessenger) {
self.messenger = messenger
@akvus
akvus / actionlist.vim
Created January 15, 2025 20:55 — forked from zchee/actionlist.vim
IdeaVim actionlist
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb <A-S-G>
$SelectAll <M-A>
$Undo <M-Z>