Hackerrank'in 30 Days of Code içerisinde bulunan "Day 29: Bitwise AND" sorusunun açıklaması ve çözümü. Bu soruda bitwise and (&) operatörünün nasıl çalıştığına bir örnek ile göz attık.
#hackerrank #programming #bitwise
► Hackerrank 30 Days of Code Çözümleri - Day 29: Bitwise AND: https://www.hackerrank.com/challenges...
00:00 | Intro
00:15 | Sorunun açıklaması
01:51 | Çözümün kodlanması
05:13 | Outro
► Problem açıklaması:
Objective
Welcome to the last day! Today, we're discussing bitwise operations. Check out the Tutorial tab for learning materials and an instructional video!
Task
Given set S = {1, 2, 3, .. N}. Find two integers, A and B (where A less B), from set S such that the value of A&B is the maximum possible and also less than a given integer, K. In this case, & represents the bitwise AND operator.
Function Description
Complete the bitwiseAnd function in the editor below.
bitwiseAnd has the following paramter(s):
int N: the maximum integer to consider
int K: the limit of the result, inclusive
Returns
int: the maximum value of A&B within the limit.
Input Format
The first line contains an integer, T, the number of test cases.
Each of the T subsequent lines defines a test case as 2 space-separated integers, N and K, respectively.
Sample Input
STDIN Function
----- --------
3 T = 3
5 2 N = 5, K = 2
8 5 N = 8, K = 5
2 2 N = 8, K = 5
Sample Output
1
4
0
***
Sosyal Medya
► Twitter'dan takip edin: / sonergonul
► Twitch'ten takip edin: / sonergonul
► Discord kanalımız: / discord
► Quora'dan takip edin: https://www.quora.com/profile/Soner-G...
Destek
► ByNoGame: https://www.bynogame.com/destekle/son...
► Stremlabs: https://streamlabs.com/sonergonul/tip