You are on page 1of 6
a cy ory 2 There are N bulbs, numbered from 1 to N, arranged in a row. The first bulb is Rg CCU nett) tena eT ae Ct eee Initially, all the bulbs are turned off. At moment Kk (for K from 0 to N-1), we SL CO aru hat elt eee aT Teh Write a function solution that, given an array A of N different integers from tt eg ae te ey at a Ly Sd 1. Given A=(2, 1, 3, 5, 4], the function should retum 3. * At the Oth moment only the 2nd bulb is tumed on, but it does Dee ee ts eR te re) Pree 2 // import java.util.*; 3 4 // you can write to stdout for debugging purposes, e.g Pa ule Met tm me) mee 6 eo ey ] public int solution(int[] A) { b +1) pt by 1 pC ay bY ime aH 5 i) for(int i=0;1 Run Tests 2.8.2]. the function should return 2. The re Ry 2 Gena value 1 occurs exactly one time: the value 2 occurs exactly Pe two times >» Ee 1 value which meets the task conditions Piss a) ae c# eee) * Write a function solution that, given an integer N, returns the maximum possible value obtainable by deleting one '5' digit eo Me Cnr a] SR ate Res lea bs eS Ba ren nm te pe Be mudi m et Peri] eh Se Be mu tia ei t hp tty Ege] i Le] ATU RUC e iy poate ee ad 8 Eds - aoe me td range eek is * Ncontains at least one '5' digit in its decimal La clead pe tae a ta ey Tokers tt] representation. eae Team lel tend beth Ds te felt tet ten oli Autocomplete is connected | Ail CR ad SO nad ey CTT). ae class Solution { public int solution(int N) { CU String eS Cnet li 6) Sse bk amr) Cnn bt ini=s.indexof("5"); Sa bad if(temp>e) Ley CET) bi LT) Sad Bia his peGs tt Eee Pete eeu. Obes) { sb=new StringBuilder(s); re Clea (ini); java x Pig (temp>e) bb a Cee ay for(int i=(temp<@)?1:0;i

You might also like