Category: c / c++
A Leap year occurs mostly every 4 years, but every 100 years, we skip a leap year, unless it is divisible by 400. Leap Year Algorithm if (year is …
Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = , nums2 = Output: Example 2: Input: nums1 = , nums2 = Output: Note: …
The Tribonacci sequence Tn is defined as follows: T0 = 0, T1 = 1, T2 = 1, and Tn+3 = Tn + Tn+1 + Tn+2 for n >= 0. …
Given an array of integers A, return the largest integer that only occurs once. If no integer occurs once, return -1. Example 1: Input: Output: 8 Explanation: The maximum …
Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as …