Kattis Problems’ Solutions: Kattis Problem Archive contains hundreds of interesting competitive programming questions. Solving these problems can be fun and challenging at times. Here in my college, students use this platform to improve their programming skills and prepare for programming contests.

Here are some of the solutions to these problems I have tried solving. All the solutions shared here are accepted solutions. I hope these solutions would give you tips to solve these questions.

**Note: The solutions here are the solutions for question Difficulty level TRIVIAL and EASY only. **

# Kattis Problems’ Solutions

## Problem: ABC

Problem Link: https://open.kattis.com/problems/abc

Sample Solution:

array=list(map(int,input().split())) ar_sorted = sorted(array, key=int) string = input() if string == 'ABC': print(ar_sorted)

## Problem: Apaxiaaaaaaaaaaaans

Problem Link: https://open.kattis.com/problems/apaxiaaans

Sample Solution:

oldstring = input() newstring = oldstring[0] for char in oldstring[1:]: if char != newstring[-1]: newstring += char print(newstring)

## Problem: Bijele

Problem Link: https://open.kattis.com/problems/bijele

Sample SOlution:

needed = [1,1,2,2,2,8] have = [int(x) for x in input().split()] difference = [] for i in range(len(needed)): difference.append(needed[i] - have[i]) print(" ".join([str(x) for x in difference]))

## Problem: Datum

Problem Link: https://open.kattis.com/problems/datum

Sample Solution:

import calendar import datetime a = [int(x) for x in input().split()] d = a[0] m = a[1] def findDay(date): born = datetime.datetime.strptime(date, '%d %m %Y').weekday() return (calendar.day_name[born]) date = "{} {} 2009".format(d, m) print(findDay(date))

## Problem: Modulo

Problem Link: https://open.kattis.com/problems/modulo

Sample Solution:

a = [] b = 0 for i in range(10): mod = a[i][0] % 42 if mod != a[i+1][0] % 42: b+=1 print(b)

## Problem: Number Fun

Problem Link: https://open.kattis.com/problems/numberfun

Sample Solution:

def arith(a, b, c): if a+b==c or a*b==c or a-b==c or b-a==c or a/b==c or b/a == c: print("possible") else: print("impossible") a = [] n = int(input()) for i in range(n): a.append([int(j) for j in input().split()]) for i in range(n): print(a[i][0], a[i][1], a[i][2])

## Problem: Sibice

Problem Link: https://open.kattis.com/problems/sibice

Sample Solution:

import math n, w, h = [int(q) for q in input().split()] hyp = math.sqrt(w*w + h*h) + 0.01 for _ in range(n): if int(input()) < hyp: print('DA') else: print('NE')

## Problem: Detailed Differences

Problem Link: https://open.kattis.com/problems/detaileddifferences

Sample Code:

num = int(input()) a = [] for i in range(num): str1 = input() str2 = input() for j in range(len(str1)): if str1[j]==str2[j]: a.append(".") else: a.append("*") print(str1) print(str2) print("".join(a))

## Problem: Nasty Hacks

Problem Link: https://open.kattis.com/problems/nastyhacks

Sample Code:

n = int(input()) for i in range(n): x = [int(y) for y in input().split()] r = x[0] e = x[1] c = x[2] if r == e-c: print("does not matter") elif r < e - c: print("advertise") else: print("do not advertise")

## Problem: Cryptographer’s Conundrum

Question Link: https://open.kattis.com/problems/conundrum

Sample Code:

cypher = input() per = "PER" count = 0 for i in range(len(cypher)): if cypher[i] != per[i%3]: count +=1 print(count)