๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.63K subscribers
5.59K photos
3 videos
95 files
10.2K links
๐ŸšฉMain Group - @SuperExams
๐Ÿ“Job Updates - @FresherEarth

๐Ÿ”ฐAuthentic Coding Solutions(with Outputs)
โš ๏ธDaily Job Updates
โš ๏ธHackathon Updates & Solutions

Buy ads: https://telega.io/c/cs_algo
Download Telegram
Scanner scanner = new Scanner(System.in);
        int numOfProducts = scanner.nextInt();
        int[] orders = new int[numOfProducts];

        for (int i = 0; i < numOfProducts; i++) {
            orders[i] = Math.abs(scanner.nextInt());
        }

        int disAmount = scanner.nextInt();
        int count = 0;

        for (int order : orders) {
            if (disAmount % order == 0) {
                count++;
            }
        }

        System.out.println(count);  

Wells Fargo Javaโœ…
๐Ÿ‘1
string getLongestRegex(string a, string b, string c)
{
  const size_t n = a.size();
  int idx = -1;
  for (int i = 0; i < n; i++) {
    if (c[i] != a[i] && c[i] != b[i]) { idx = i; }
  }
  if (idx == -1) return "-1";
  string res;
  for (int i = 0; i < n; i++) {
   
    if (i == idx) {
      string cur = "[";
      for (int j = 'A'; j <= 'Z'; j++)  if (j != c[i]) cur += j;
      cur += "]";
      res += cur;
    } else {
      res += "[ABCDEFGHIJKLMNOPQRSTUVWXYZ]";
    }
  }
  return res;
}


C++โœ…
def minimumCost(price):
    n = len(price)
    price.append(0)
    ans = float('inf')
    last = {price[0]: 0}
    for i in range(1, n):
        v = price[i]
        price[i] += price[i - 1]
        if last.get(v) != None:
            ans = min(ans, price[i] - price[last[v]] + v)
        last[v] = i
    return ans if ans != float('inf') else -1

n = int(input())
price = list(map(int,input().split(' ')))
print(minimumCost(price))

Python 3โœ…
Amazon