Let's assume that the feature branch is called feature
and the main branch main
:
- Create a temporary (say
temp
) branch frommain
:
git checkout -b temp main
- Squash the feature branch in:
// A sample program that connects to the headscale gRPC server | |
// and lists all the API keys | |
// | |
// Usage Example: go run main.go -server=localhost:50443 -apikey=3GbSjH5IqA.1FPG5ZiqB3a8idtvJnhBjCSb_V5pffuaLyFJyYZNPlQ | |
package main | |
import ( | |
"context" | |
"flag" |
package main | |
import ( | |
"context" | |
"errors" | |
"log" | |
"net/http" | |
"os" | |
"os/signal" | |
) |
def longestSubstr(s): | |
for i in range(1, len(s)): | |
if s[i] > s[0]: | |
break | |
# For cases like, AABAB | |
# BAB is lexicographically greater, however, | |
# ABAB is the longest such substring | |
while i > 1 and s[i-1] == s[0]: | |
i -= 1 |
""" | |
Given a string s, return the longest palindromic substring in s | |
Example 1: | |
Input: s = "babad" | |
Output: "bab" | |
Note: "aba" is also a valid answer. | |
Example 2: | |
Input: s = "cbbd" |
""" | |
Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order. | |
Example 1: | |
Input: nums = [1,2,3] | |
Output: [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] | |
Example 2: | |
Input: nums = [0,1] | |
Output: [[0,1],[1,0]] |
package main | |
/* | |
* Given an array, print the Next Greater Element (NGE) for every element. | |
* The next greater element for an element x is the first greater element | |
* on the right side of x in the array. Elements for which no greater | |
* element exists, consider the next greater element as -1. | |
*/ | |
import "fmt" |
""" | |
You are given an n x n 2D matrix that represents an image. | |
Rotate the image by 90 degrees (clockwise) using O(1) extra space | |
""" | |
def rotateImageClockwiseBy90(a): | |
""" | |
The solution here is to find the elements to swap. We will do it | |
in cycles. First, identify the groups: | |
(x, y), (y, N-1-x), (N-1-x, N-1-y), (N-1-y, x) |
def key_in_dict(d, k): | |
if isinstance(d, list): | |
for v in d: | |
return key_in_dict(v, k) | |
if isinstance(d, dict): | |
if k in d: | |
return True | |
for v in d.values(): | |
return key_in_dict(v, k) | |
return False |
""" | |
Given a sorted array, remove the duplicates from the array in-place such that each element appears at most twice, and return the new length. | |
Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. | |
Example | |
Given array [1, 1, 1, 3, 5, 5, 7] | |
The output should be 6, with the first six elements of the array being [1, 1, 3, 5, 5, 7] |