Skip to content

Instantly share code, notes, and snippets.

models:
- name: Llama-2-Chat
displayName: Llama-2-Chat (Before 24.02)
description: Llama-2-Chat model published by Meta
versions:
- latestVersionId: LLAMA-2-70B-CHAT
sha: ff6d1c3ba37b31d4af421951c2300f2256fb3691
latestVersionSizeInBytes: 107224858679
createdDate: 2023-10-24T18:21:04.610Z
updatedDate: 2024-04-23T22:57:49.590Z
import logging
import logging as log
from pathlib import Path
from pyspark.sql import DataFrame
from pyspark.sql.types import StructType
from pyspark.sql.functions import udf
from pyspark.sql.types import StructField
from pyspark.sql.functions import lit
train_dir = '/home/cdsw/datasettrees'
import numpy as np
import glob
import os
import matplotlib.pyplot as plt
from PIL import Image
train_list = glob.glob(train_dir+'/**/*.jpg',recursive=True)
print(train_list)
!pip3 install torch torchvision pandas numpy onnx onnxruntime
import argparse
import torch
import torch.nn.functional as F
from torch import nn, optim
from torch.optim.lr_scheduler import StepLR
from torchvision import datasets, transforms
all permutations of N dice roll
def combine(self, n: int, k: int) -> List[List[int]]:
combs = []
def backtrack(index, path):
if len(path) == k:
combs.append(list(path))
return
for i in range(index, n+1):
class Solution {
public:
bool isValidSudoku(vector<vector<char>>& board) {
unordered_set<string> seen;
for (int i = 0; i < 9; ++i)
for (int j = 0; j < 9; ++j) {
if (board[i][j] == '.')
continue;
const string c(1, board[i][j]);
Nearest Neighbour City
A number of cities are arranged on a graph that has been divided up like an ordinary Cartesian plane. Each city is located at an integral (x, y) coordinate intersection. City names and locations are given in the form of three arrays: c, x, and y, which are aligned by the index to provide the city name (c[i]), and its coordinates, (x[i], y[i]). Determine the name of the nearest city that shares either an x or a y coordinate with the queried city. If no other cities share an x or y coordinate, return 'NONE'. If two cities have the same distance to the queried city, q[i], consider the one with an alphabetically shorter name (i.e. 'ab' < 'aba' < 'abb') as the closest choice. The distance is the Manhattan distance, the absolute difference in x plus the absolute difference in y.
The time complexity for my solution is O(NlogK) for processing input + O(QlogK) for returning the result for all the given queries,
where N is the number of cities, K is the max number of cities with same x or y coo
At DoorDash, menus are updated daily even hourly to keep them up-to-date. Each menu can be regarded as a tree. When the merchant sends us the latest menu, can we calculate
how many nodes have changed/added/deleted?
Assume each Node structure is as below:
class Node {
String key;
int value;
List children;
}
nput - ("mon 10:00 am", mon 11:00 am)
Output - [11005, 11010, 11015...11100]
Output starts with 1 if the day is monday, 2 if tuesday and so on till 7 for sunday
Append 5 min interval times to that till the end time
So here it is 10:05 as first case, so its written as 11005
2nd is 10:10 so its written as 11010
...
...
Stop at 11100
@smothiki
smothiki / island.go
Created January 7, 2024 16:04
island
func largestIsland(grid [][]int) int {
n:=len(grid)
if n==0{
return 0
}
visited:=make([][]bool,n)
for i:=0; i<n; i++ {
visited[i]=make([]bool,n)
}
islandArea:=make(map[int]int)