Skip to content

Instantly share code, notes, and snippets.

import java.util.*;
import java.util.stream.*;
class Scratchpad {
// There is a dictionary containing words from an alien language for which we don’t know the ordering of the alphabets.
// Write a method to find the correct order of the alphabets in the alien language. It is given that the input is a valid dictionary and there exists an ordering among its alphabets.
// Example 1:
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode() {}
* ListNode(int val) { this.val = val; }
* ListNode(int val, ListNode next) { this.val = val; this.next = next; }
* }
*/
@adeydas
adeydas / cyclell1.java
Created May 17, 2021 03:26
LinkedList cycle detection using Flyod algorithm
/**
* Definition for singly-linked list.
* class ListNode {
* int val;
* ListNode next;
* ListNode(int x) {
* val = x;
* next = null;
* }
* }
@adeydas
adeydas / reverseLL.java
Created May 17, 2021 03:13
Reverse LinkedList - Iterative
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode() {}
* ListNode(int val) { this.val = val; }
* ListNode(int val, ListNode next) { this.val = val; this.next = next; }
* }
*/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array> <dict>
<key>UserDefinedName</key>
<string>AbhiNita VPN profile</string>
<key>PayloadDisplayName</key>
<string>AbhiNita VPN profile</string>
public Response handleRequest(Map<String, Object> request, Context context) {
LOG.info("My lambda has started with request {}", request);
throw new RuntimeException("Failed: Something bad happened");
}
@Slf4j
public class Invalidate {
private static final String CLOUD_FRONT_DISTRIBUTION_ID = System.getenv("distribution_id");
private static final AmazonCloudFront AMAZON_CLOUD_FRONT_CLIENT
= AmazonCloudFrontClient.builder().withCredentials(new EnvironmentVariableCredentialsProvider())
.withRegion(Regions.US_WEST_2).build();
public void invalidateListOfItems(final List<String> itemsToInvalidate) {
@Slf4j
public class LambdaHandler implements RequestHandler<S3EventNotification, Response> {
private Invalidate invalidate = new Invalidate();
public Response handleRequest(S3EventNotification request, Context context) {
final List<S3EventNotificationRecord> records = request.getRecords();
final List<String> objectIdsToInvalidate = Lists.newArrayList();
{{ $paginator := .Paginate (where .Data.Pages "Type" "posts") }}
{{if lt (len $paginator.Pages) 1}}
<h1>All Tags</h1>
{{ range $.Site.Taxonomies.tags.ByCount }}
<span>
<a href="/tags/{{ .Name }}"> {{ .Name }} <small>({{ .Count }})</small></a>
</span>
<span>&nbsp;</span>
{{end}}
{{end}}
{{ range $.Site.Taxonomies.tags.ByCount }}
<span>
<a href="/tags/{{ .Name }}"> {{ .Name }} <small>({{ .Count }})</small></a>
</span>
<span>&nbsp;</span>
{{end}}