RMAG news

Maximum Number of Vowels in a Substring of Given Length | LeetCode | Java

class Solution { public int maxVowels(String s, int k) { Set<Character> set = new HashSet<>(); set.add(‘a’); set.add(‘e’); set.add(‘i’); set.add(‘o’); set.add(‘u’); char arr[] = s.toCharArray(); int count = 0, maxCount = 0; for(int i=0; i<k; i++){ if(set.contains(arr[i])) count++; } maxCount = count; int n = arr.length; for(int i=k; i<n; i++){ if(set.contains(arr[i])) count++; if(set.contains(arr[i-k])) count–; maxCount =…

Citeste mai mult
RMAG news

Beginner’s Guide to Building Powerful Android Apps with Kotlin from the Ground Up

In the rapidly evolving landscape of mobile app development, Kotlin has emerged as a powerful programming language for creating robust and efficient applications. This article serves as a comprehensive guide for beginners looking to build an app from scratch using Kotlin. From setting up the development environment to designing the app architecture, implementing key features,…

Citeste mai mult