CyclicRotation : ๋ด๊ฐ ํด๊ฒฐํ ๊ฒ
CyclicRotationModify : ๊ฒ์ํ์ฌ ์ป์ ํด๊ฒฐ
CyclicRotationSecond : 2๋ฒ์งธ ๋ด๊ฐ ํด๊ฒฐํ ๊ฒ(๋์ค์)
CyclicRotationSecondModify : ๊ฒ์ํ์ฌ ์ป์ ํด๊ฒฐ(๋์ค์)
- BinaryGap (38 mins) - ์ฐ์๋ 0์ ๊ฐฏ์
https://app.codility.com/demo/results/trainingMA8RDH-CMV/ (100%)
์ฐ์๋๋ 0์ ์ต๋ ๊ฐฏ์ ๊ตฌํ๋ ๋ฌธ์ ์ซ์๋ฅผ ์ด์ง์๋ก ๋ณ๊ฒฝํ๋ ๋ฒ Integer.toBinaryString(N)
-
OddOccurrencesInArray (18 mins) - ํ์ ๊ฐ์ธ ์ซ์
https://app.codility.com/demo/results/trainingSSES8M-URY/ (100%)
https://app.codility.com/demo/results/trainingFGTW3B-SWJ/ (100%)์ง์ ์ด๋ฃจ์ง ์๋ ๊ฐ ์ฐพ๋ ๋ฌธ์ hashMap key๊ฐ ๊ฐ์ ธ์ค๊ธฐ for (Map.Entry<Integer, Integer> entry : hMap.entrySet()) ์ฒซ ๋ฒ์งธ ๋ฐฉ๋ฒ๋ 100% ์ด์ง๋ง ๋ฐ๋ณต๋ฌธ์ ๋ ๋ฒ ๋๋ฆฌ์ง ์๊ณ ํ๋ฒ์ ํ๋ ๋ฐฉ๋ฒ์ผ๋ก ๊ฐ์ -
CyclicRotation - ๋ฐฐ์ด ์ด๋
https://app.codility.com/demo/results/trainingETGJVN-X3S/ (100%)
์ฒ์๋ถํฐ ์ฐธ๊ณ . ์ํ์ ์ ๊ทผ ํ์
-
FrogJmp (5 mins)https://app.codility.com/demo/results/training9QJ7BS-KMD/ (100%)
๋ฐ๋ณต๋ฌธ์ด ์๋ ์ํ์ ์ผ๋ก ์ ๊ทผ -
PermMissingElem (6 mins) - ๋ฐฐ์ด ์ค๊ฐ์ ๋น ์ง ์ซ์ ๋ฆฌํด
https://app.codility.com/demo/results/trainingXNAFCU-FB3/ (50%) https://app.codility.com/demo/results/trainingWPG5X9-65J/ (50%) https://app.codility.com/demo/results/trainingPP76RN-RF3/ (100%)
๋น ๋ฐฐ์ด์ผ ๊ฒฝ์ฐ 0์ด ์๋ 1 ๋ฆฌํดํด์ผ ํจ. 1~N+1 ์ ๋ฒ์์ด๋ฏ๋ก {1}์ธ ๊ฒฝ์ฐ 2 ๋ฆฌํด. -
TapeEquilibrium (18 mins)
https://app.codility.com/demo/results/trainingVBBRMM-RSS/ (84%) https://app.codility.com/demo/results/trainingQDMG46-EYH/ (92%, Performance ์ด์) https://app.codility.com/demo/results/trainingVJ7Y5S-GUS/ (100%)
{-1000,1000} ์ธ ๊ฒฝ์ฐ -2000 ๋ฆฌํด ์ ์ฒด ํฉ์ ์คํธ๋ฆผ(IntStream.of(A).sum())์ด ์๋ ๋ฐ๋ณต๋ฌธ์ผ๋ก ๊ฐ์ ํ์ฌ ์ฑ๋ฅ ํฅ์ -
MaxCounters - Respectable (79 mins)https://app.codility.com/demo/results/trainingMAVYQB-6TT/ (100%)
N๋ณด๋ค ํฐ ๋ฐฐ์ด ์์ ์ถ์ถ ([2,4,4,6,1,2,6,2] -> [2,4,4],[1,2],[2] ์์ [2,4,4],[1,2]) ๋ฐฐ์ด ์์์ ๊ฐฏ์-1 (๋ง์ง๋ง์ increase ์ ์ฉํด์ผ ํ๋ฏ๋ก) ๊ฐ์ ๋ฐฐ์ด์์ ๊ฐ๊ฐ ์ ์ผ ๋ง์ด ๋ฐ๋ณต๋๋ ์ซ์์ ๊ฐฏ์ ๋ํด์ค ๋ํด์ค ์๋ฅผ ๊ธฐ๋ณธ ๊ฐฏ์๋ก ์ ํ (0์ด ์๋) ์ด ํ ๋ง์ง๋ง ๋ฐฐ์ด์์ increase ์ํ -
(TO DO) MissingInteger - Respectable
- PermCheck (6 mins)
https://app.codility.com/demo/results/trainingR7CP95-84S/ (100%)
-
PassingCars (18 mins)https://app.codility.com/demo/results/trainingA3SQ4D-THQ/ (50%) https://app.codility.com/demo/results/trainingXTY4B8-RD6/ (100%)
๋ก์ง์ ๋ง์ผ๋ ํผํฌ๋จผ์ค ์ด์ O(N ** 2) -> O(N) ๋ก ๊ฐ์ -
(TO DO) MinAvgTwoSlice - Respectable
-
MaxProductOfThree (10 mins)- ๋ฐฐ์ด ์ค ๊ณฑํ์ ๋ ๊ฐ์ฅ ํฐ ์https://app.codility.com/demo/results/trainingVP52WH-PNQ/ (100%)
-
Distinct (10 mins)- ๋ฐฐ์ด์ ๊ณ ์ ๊ฐ ๊ฐฏ์ ์ธ๊ธฐhttps://app.codility.com/demo/results/training4ESK5A-ZST/ (100%)
TreeSet์ด ์๋ HashSet ์ฌ์ฉ (์์ ํ์์์ด ๋จ์ ์ค๋ณต์ ๊ฑฐ์ฉ์ด๋ฏ๋ก) -
Triangle (23 mins)
https://app.codility.com/demo/results/trainingCEMEJ3-YKU/ (68%) https://app.codility.com/demo/results/trainingBCB8VP-D72/ (100%)
๋ก์ง ์ค๋ฅ. ํจ์ ์ฌ์ฉ ํ์. overflow ๊ณ ๋ ค. -
(TO DO) NumberOfDiscIntersections - Respectable
-
Brackets (24 mins)- ๊ดํธ ์ ํฉ์ฑ ์ฒดํฌhttps://app.codility.com/demo/results/trainingM4JPSZ-SPF/ (100%)
-
Fish (43 mins) - ์ด์๋จ์ ๋ฌผ๊ณ ๊ธฐ ๊ฐฏ์
https://app.codility.com/demo/results/training9EPCFM-W5K/ (37%) https://app.codility.com/demo/results/trainingUK2PJR-D82/ (100%)
์ฒ์๋ถํฐ ํด๊ฒฐ๋ฐฉํฅ ์ฐธ๊ณ ํจ. ํ ์ชฝ์ ์ผ์ด์ค๋ฅผ ์คํ์ ๋ด์๋๊ณ ๋น๊ต. ์คํ์ ๋จ์์๋ ์์ ๊ฐฏ์๊ฐ ์๋ ๋ณ๋ ๋ณ์ -
Nesting (18 mins)
https://app.codility.com/demo/results/trainingK46G4V-4UR/ (62%) https://app.codility.com/demo/results/trainingXQR94S-EGZ/ (75%) https://app.codility.com/demo/results/trainingNVFCC8-AMM/ (100%)
S์ ๊ฐ์ด ๋น์ด์์ด๋ ์ฐธ์ ๋์นจ stack์ ๊ฐ์ ์๋ชป ๊ณ์ฐํจ -
StoneWall
https://app.codility.com/demo/results/trainingAXM8J7-UX7/ (100%)
์ฒ์๋ถํฐ ์ฐธ๊ณ ์คํ ์ด์ฉ ๋์ด๊ฐ ์ด์ ๋ฒฝ๋๋ณด๋ค ์์ผ๋ฉด ๋น๊ต ๋์ ์ ๊ฑฐ ๋์ด๊ฐ ์ด์ ๋ฒฝ๋๋ณด๋ค ๋์ผ๋ฉด ์๋ก์ด ๋ฒฝ๋ ๋์ด๊ฐ ๊ฐ์ผ๋ฉด ๋๊น (=๊ฐ์ ๋ฒฝ๋)
-
Dominator (11 mins)- ๋ฐฐ์ด ์ค ์ ๋ฐ์ด ๋๋ ๊ฐ์ ์ธ๋ฑ์ค ๋ฆฌํดhttps://app.codility.com/demo/results/trainingVMMDJV-7B7/ (100%)
-
EquiLeader (111 mins)
https://app.codility.com/demo/results/trainingQWKCEA-6YN/ (33%) https://app.codility.com/demo/results/training6NQGGH-AWZ/ (100%)
๋ ผ๋ฆฌ ์ด์, Performance ์ด์ ์ ์ชฝ์ equi Leader ์นด์ดํธ ์ ์กฐ๊ฑด๋ฌธ ๋ณ๊ฒฝํ์ฌ ๊ณ์ฐ
-
MaxProfit (36 mins)
https://app.codility.com/demo/results/trainingURR32N-GKE/ (44%) https://app.codility.com/demo/results/trainingTVPXWK-6UX/ (100%)
์ต์๊ฐ nMin ๋ณ์ ์ธ๋ฑ์ค๊ฐ ๋์ ๋ฐฐ์ด์์ nMin ๋ณ์๋ฅผ ๋นผ๋ฉด์ ๊ฐ์ฅ ํฐ ์ฐจ์ก ๋ฐ์ดํฐ ๋ณด๊ด Math.min(nMin, n) Math.max(nMax, n-nMin) -
MaxSliceSum (54 mins)
https://app.codility.com/demo/results/trainingW4A93M-5T3/ (69%) https://app.codility.com/demo/results/trainingHNSN8Q-BVV/ (100%)
{3,-2, 3}์ธ ๊ฒฝ์ฐ ์คํจ (3์ด ์๋ 4๊ฐ ๋์์ผ ํจ, 3-2+3=4) ์์์ ์์๊ฐ ์์ธ ๊ฒฝ์ฐ ์์๋ฅผ ๊ธฐ์ค์ผ๋ก slice ํ๋ค๋ ๊ฐ์ ์์ ์ค๋ฅ -
(TO DO) MaxDoubleSliceSum - Respectable
-
CountFactors (11 mins) - ์ธ์๊ตฌํ๊ธฐ, sqrt
https://app.codility.com/demo/results/training4477RF-9WB/ (71%, Performance ์ด์) https://app.codility.com/demo/results/trainingEEZHBR-X6C/ (100%)
์ฝ์ ๊ตฌํ๊ธฐ O(N) ๋ฐฉ์์ผ๋ก ํ๋ฉด ์๊ฐ์ด๊ณผ (Performance ์ด์) O(sqrt(N))์ผ๋ก ํ์ด์ผ ํจ (int) Math.sqrt(N) -
MinPerimeterRectangle (14 mins)- ๊ณต์ฝ์https://app.codility.com/demo/results/trainingAD5M68-6TJ/ (100%)
๊ณต์ฝ์ ๊ตฌํ๋ ๋ฌธ์
- ChocolatesByNumbers - ์ต๋ ๊ณต์ฝ์
https://app.codility.com/demo/results/trainingKFZVE4-888/ (100%)
์ฒ์๋ถํฐ ์ฐธ๊ณ ์ต๋ ๊ณต์ฝ์ ๊ตฌํด์ N/์ต๋ ๊ณต์ฝ์
-
CountDistinctSlices (52 mins) - ๊ณ ์ ๊ฐ ๊ฐฏ์
https://app.codility.com/demo/results/trainingWG6ACZ-2YT/ (70%) https://app.codility.com/demo/results/trainingMA2M84-YWX/ (100%)
๋ก์ง์ ๋ง์์ผ๋ ํผํฌ๋จผ์ค ์ด์. O(N * (N + M)) -> O(N)์ผ๋ก ๊ฐ์ ์ญ์๋ caterpillar๋ ์์ง ์ ์ดํด๊ฐ ์๊ฐ. ๋์ค์ ์ข ๊น๊ฒ ๋ด์ผ๊ฒ ์... -
CountTriangles
https://app.codility.com/demo/results/trainingQ776CZ-C7U/ (100%)
์ฒ์๋ถํฐ ์ฐธ๊ณ ์์ง๋ triangeCnt += r - q - 1; ์ด ๋ถ๋ถ์ ์ ์ดํด๊ฐ ์๊ฐ -
AbsDistint (14 mins)https://app.codility.com/demo/results/trainingTPFJJ4-EPV/ (100%)
-
TieRopes (16 mins)
https://app.codility.com/demo/results/trainingQKBWMK-MJB/ (12%)
https://app.codility.com/demo/results/trainingUW5WNX-4JT/ (100%)๋ฌถ์ธ ๋ฐง์ค์ ๊ฐฏ์๋ฅผ ๋ฆฌํดํ๋ ๊ฒ์ผ๋ก ์๋ชป ์ดํดํจ. ์ต์ข ์ ์ผ๋ก ๋๋ ์ง ๋ฐง์ค์ ๊ฐฏ์๋ฅผ ๋ฆฌํดํ๋ ๊ฒ์ด์์. -
MaxNonoverlappingSegments
https://app.codility.com/demo/results/trainingW3M8SP-JNY/ (100%)
์ฒ์๋ถํฐ ์ฐธ๊ณ ํจ. A={1,3} / B={5,6} ์ธ ๊ฒฝ์ฐ ๊ฒน์น์ง ์๋ ์ธ๊ทธ๋จผํธ๊ฐ ์์ผ๋ 0์ ๋ฆฌํดํด์ผ ํ๋๋ฐ int segCnt = 1; ์ ๊ธฐ๋ณธ์ ์ผ๋ก 1์ ๊น๊ณ ๊ฐ๋์ง ์ดํด๊ฐ ์๊ฐ.
- LongestPassword (32 mins) - ์ ๊ท์
https://app.codility.com/demo/results/trainingDCF3DA-ETS/ (30%) https://app.codility.com/demo/results/trainingYD5VX7-5UW/ (70%) https://app.codility.com/demo/results/trainingG8M2AF-5EW/ (100%) https://app.codility.com/demo/results/trainingKTT9UZ-MFE/ (100%)
์ ๊ท์ ์ฌ์ฉ ์ซ์ 1๊ฐ๋ก๋ง์ผ๋ก ๊ตฌ์ฑ ๊ฐ๋ฅํ ๋ถ๋ถ ๋์นจ (์ํ๋ฒณ์ ์ง์์ด๋ฏ๋ก 0๊ฐ์ฌ๋ ๋จ) charAt ๋น๊ต ์ ์ซ์๊ฐ ์๋ char๋ก ๋น๊ตํ ๊ฒ s.charAt(i) >= '0' ์ด์ค ๋ฐ๋ณต๋ฌธ ๊ฐ์
TennisTournament (22 mins)https://app.codility.com/demo/results/trainingXCT9MU-QBN/ (100%)
-
SqlSum (1 mins)https://app.codility.com/demo/results/trainingYN6B48-RF6/ (100%)
-
StrSymmetryPoint (17 mins)https://app.codility.com/demo/results/trainingSNKBXM-8GA/ (100%)
-
TreeHeight - ์ด์งํธ๋ฆฌ ๊ธธ์ด
https://app.codility.com/demo/results/trainingPSBAES-Q5Z/ (100%)
์ฒ์๋ถํฐ ์ฐธ๊ณ ์ด์งํธ๋ฆฌ ๊ธธ์ด๊ตฌํ๋ ๋ฌธ์