LeetCode Weekly Contest 369 1問目 - Find the K-or of an Array [2917]

Source

LeetCode Weekly Contest 369
問題文

問題概要

省略

解法

省略

cLay(version 20231031-1)のコード

C++に変換後のコードはこちら

#define main dummy_main
{}
#undef main

class Solution {
public:
  int findKOr(VI &A, int K) {
    int res = 0, c[31] = {}, N = A.size();
    for(int x : A) rep(j,31) if(BIT_ith(x,j)) c[j]++;
    rep(j,31) if(c[j] >= K) res |= BIT_ith(j);
    return res;
  }
};

Current time: 2024年05月06日00時42分35秒
Last modified: 2023年10月31日21時48分48秒 (by laycrs)
Tags: Competitive_Programming_Incomplete LeetCode
トップページに戻る

Logged in as: unknown user (not login)

ログイン: