Number of 1 Bits
The Fellow Programmer
by Fellow Programmer
3y ago
Write a function that takes an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight). Note: Note that in some languages such as Java, there is no unsigned integer type. In this case, the input will be given as a signed integer type. It should not affect your implementation, as the integer's internal binary representation is the same, whether it is signed or unsigned. In Java, the compiler represents the signed integers using 2's complement notation. Therefore, in Example 3 above, the input represents the signed integer ..read more
Visit website
Merge Sorted Array
The Fellow Programmer
by Fellow Programmer
3y ago
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. The number of elements initialized in nums1 and nums2 are m and n respectively. You may assume that nums1 has enough space (size that is equal to m + n) to hold additional elements from nums2. Example 1: Input: nums1 = [1,2,3,0,0,0], m = 3, nums2 = [2,5,6], n = 3Output: [1,2,2,3,5,6] Example 2: Input: nums1 = [1], m = 1, nums2 = [], n = 0Output: [1] Constraints: 0 <= n, m <= 200 1 <= n + m ..read more
Visit website
Check If Two String Arrays are Equivalent
The Fellow Programmer
by Fellow Programmer
3y ago
Given two string arrays word1 and word2, return true if the two arrays represent the same string, and false otherwise. A string is represented by an array if the array elements concatenated in order forms the string.   Example 1: Input: word1 = ["ab", "c"], word2 = ["a", "bc"]Output: trueExplanation:word1 represents string "ab" + "c" -> "abc"word2 represents string "a" + "bc" -> "abc"The strings are the same, so return true. Example 2: Input: word1 = ["a", "cb"], word2 = ["ab", "c"]Output: false Example 3: Input ..read more
Visit website
Merge Two Sorted Lists
The Fellow Programmer
by Fellow Programmer
3y ago
Merge two sorted linked lists and return it as a sorted list. The list should be made by splicing together the nodes of the first two lists. Example 1: Input: l1 = [1,2,4], l2 = [1,3,4]Output: [1,1,2,3,4,4] Example 2: Input: l1 = [], l2 = []Output: [] Example 3: Input: l1 = [], l2 = [0]Output: [0] Constraints: The number of nodes in both lists is in the range [0, 50]. -100 <= Node.val <= 100 Both l1 and l2 are sorted in non-decreasing order. Solution: /**  * Definition for singly-linked list.  * public class ListNode { &nb ..read more
Visit website
Determine if String Halves Are Alike
The Fellow Programmer
by Fellow Programmer
3y ago
You are given a string s of even length. Split this string into two halves of equal lengths, and let a be the first half and b be the second half. Two strings are alike if they have the same number of vowels ('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'). Notice that s contains uppercase and lowercase letters. Return true if a and b are alike. Otherwise, return false. Example 1: Input: s = "book"Output: trueExplanation: a = "bo" and b = "ok". a has 1 vowel ..read more
Visit website
Agile Principles
The Fellow Programmer
by Fellow Programmer
3y ago
In the previous article, we learned about Agile Manifesto. Here, in this article we are going to note down the principles of agile. Source: Google Principles of Agile: Satisfy Customer through early and continuous delivery. Welcome, change requirement even in late development. Deliver working software frequently [i.e., couple of weeks to couple of months] Business people and developers work together daily. Build projects under motivated individuals.[Give each individual, a required environment, support they need and trust them to get the job done] Convey information to developer tea ..read more
Visit website
Balanced Binary Tree
The Fellow Programmer
by Fellow Programmer
3y ago
Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as: a binary tree in which the left and right subtrees of every node differ in height by no more than 1. Example 1: Input: root = [3,9,20,null,null,15,7]Output: true Example 2: Input: root = [1,2,2,3,3,null,null,4,4]Output: false Example 3: Input: root = []Output: true   Constraints: The number of nodes in the tree is in the range [0, 5000]. -104 <= Node.val <= 104 Solution: /**  * Definition for a binary tree node.  * public ..read more
Visit website
Smallest Range II
The Fellow Programmer
by Fellow Programmer
3y ago
Given an array A of integers, for each integer A[i] we need to choose either x = -K or x = K, and add x to A[i] (only once). After this process, we have some array B. Return the smallest possible difference between the maximum value of B and the minimum value of B. Example 1: Input: A = [1], K = 0Output: 0Explanation: B = [1] Example 2: Input: A = [0,10], K = 2Output: 6Explanation: B = [2,8] Example 3: Input: A = [1,3,6], K = 3Output: 3Explanation: B = [4,6,3] Note: 1 <= A.length <= 10000 0 <= A ..read more
Visit website
Agile Manifesto
The Fellow Programmer
by Fellow Programmer
3y ago
In the previous article, we learned about history of Agile. Now, in this article you will find about the Manifesto of Agile  Source: Google Agile Manifesto: Below are the manifesto of Agile., Individuals and Interactions over process and tools Working software over comprehensive documentation Customer Collaboration over contract negotiation Responding to the change over following the plan. Related Posts: List of all Leetcode Problems with Solutions and Explanation  Explore more on our blog Agile Contents Like us? Please do share with your friends ..!! Follow us to rec ..read more
Visit website
Agile History
The Fellow Programmer
by Fellow Programmer
3y ago
In this chapter, we are going to learn about Agile. Here, we discussed about few points which we will give you a history and evolution of agile. In whole learning most of the articles are written as points or notes, so that anyone can understand and learn easily. Source: Google Agile can be described in many ways. One among those is, Agile is not a specific model/process, it is a mindset. During early 1990's many of the light weight development models evolved to overcome drawbacks from Waterfall Model, Iterative Model etc. These includes Rapid Application Development(RAD), Unified pr ..read more
Visit website

Follow The Fellow Programmer on FeedSpot

Continue with Google
Continue with Apple
OR