Skip to content

Instantly share code, notes, and snippets.

View priyankshah217's full-sized avatar
🎯
Focusing

Priyank Shah priyankshah217

🎯
Focusing
View GitHub Profile
@priyankshah217
priyankshah217 / Programming_solutions.go
Created February 21, 2022 07:44
programming_solutions
package main
import (
"math"
"sort"
)
// Problem 7
func findMinNoOfPlatformRequired(arrivals []int, departures []int) int {
sort.Ints(arrivals)
@priyankshah217
priyankshah217 / lt-438.go
Created January 5, 2022 10:55
Find anagrams (leetcode-438)
import (
"crypto/sha1"
"fmt"
)
func findAnagrams(sentence string, pattern string) []int {
var arrayIndex []int
if len(pattern) == 0 || len(sentence) == 0 {
return arrayIndex
}
@priyankshah217
priyankshah217 / producer_consumer.go
Created December 10, 2021 06:31
ProducerConsumer In Go
package main
import (
"fmt"
"strconv"
"sync"
"time"
)
const MaxItems = 100
@priyankshah217
priyankshah217 / find_occurances.go
Last active August 24, 2021 08:17
Find no of patterns in given string
func findOccurrencesOfSubstrings(input string, pattern string) int {
if len(input) == 0 || len(pattern) == 0 {
return 0
}
charPatternArray := []rune(pattern)
charInputArray := []rune(input)
patternCharTable := getLookupTable(charPatternArray)
inputCharTable := getLookupTable(charInputArray)
inputSum := 0
patternSum := 0
@priyankshah217
priyankshah217 / FallBackExample.java
Created August 14, 2021 12:41
Fallback example
import okhttp3.OkHttpClient;
import okhttp3.Request;
import java.io.IOException;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class FallBackExample {
@priyankshah217
priyankshah217 / Sample.json
Created July 22, 2021 13:09
ErrorHandlingAndNullChecks Java8 Way
[
{
"EventID": "1",
"EventName": "login",
"CommonAttributes": {
"Location": "NY",
"Country": "US"
}
},
{
@priyankshah217
priyankshah217 / perf_iteration_vs_streams.java
Last active April 6, 2021 07:23
Performance comparison of iteration vs steams
import org.jetbrains.annotations.NotNull;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;
public class Solution {
public static void main(String[] args) {
String str = "Basic Service Set (BSS): A set of stations controlled by a single coordination function.\n" +
@priyankshah217
priyankshah217 / ATD_FullExecution.log
Created October 31, 2020 17:50
ATD_FullExecution
2020-10-31 17:45:15:668 [Appium] Welcome to Appium v1.18.3
2020-10-31 17:45:15:669 [Appium] Non-default server args:
2020-10-31 17:45:15:670 [Appium] address: 127.0.0.1
2020-10-31 17:45:15:670 [Appium] port: 15261
2020-10-31 17:45:15:670 [Appium] logFile: /Users/priyank.shah@xyz.com/IdeaProjects/AppiumTestDistribution/target/appiumlogs/appium_logs.txt
2020-10-31 17:45:15:670 [Appium] relaxedSecurityEnabled: true
2020-10-31 17:45:15:690 [Appium] Appium REST http interface listener started on 127.0.0.1:15261
2020-10-31 17:45:15:857 [HTTP] --> GET /wd/hub/status
2020-10-31 17:45:15:858 [HTTP] {}
2020-10-31 17:45:15:859 [GENERIC] Calling AppiumDriver.getStatus() with args: []
@priyankshah217
priyankshah217 / ATD_AppiumLogs
Last active October 30, 2020 14:00
afterinvocation immediately called without running tests.
Oct 30, 2020 7:18:19 PM com.appium.utils.ConfigFileManager <clinit>
INFO: Using config file from [./configs/config.properties]
Oct 30, 2020 7:18:19 PM com.appium.schema.CapabilitySchemaValidator validateRemoteHosts
INFO: ATD is Running on 127.0.0.1
_ _ _ _ _ _
__| | (_) ___ | |_ _ __ (_) | |__ _ _ | |_ ___
/ _` | | | / __| | __| | '__| | | | '_ \ | | | | | __| / _ \
| (_| | | | \__ \ | |_ | | | | | |_) | | |_| | | |_ | __/
\__,_| |_| |___/ \__| |_| |_| |_.__/ \__,_| \__| \___|
public class FindAllPermutationsInGivenString {
public static void main(String[] args) {
FindAllPermutationsInGivenString obj = new FindAllPermutationsInGivenString();
String inputText = "abcdefcabdpqrbcaz";
String inputWord = "dbca";
List<Integer> listOfStartingIndex = obj.getListOfStartingIndex(inputText, inputWord);
listOfStartingIndex.forEach(System.out::println);
}
private List<Integer> getListOfStartingIndex(String inputText, String inputWord) {