Skip to content

Instantly share code, notes, and snippets.

View IvanReznikov's full-sized avatar

Ivan Reznikov IvanReznikov

View GitHub Profile
Feature LangChain LLM ChatGPT
Type Framework Model Model
Purpose Build applications with LLMs Generate text Generate chat conversations
Key features Chains prompts memory Large dataset of text and code Large dataset of chat conversations
Advantages Can combine LLMs with other programming techniques Generates human-quality text Generates realistic chat conversations
Disadvantages Requires some programming knowledge Not as easy to use for specific tasks Not as versatile as LangChain
@IvanReznikov
IvanReznikov / is_nan.py
Last active January 28, 2022 10:02
Python NaN check
def pandas_nan(x):
import pandas as pd
return pd.isna(x)
def numpy_nan(x):
import numpy as np
return np.isnan(x)
def math_nan(x):
import math
import (
"sort"
)
//In this solution you'll see some uglyness. Mostly because I don't know go well, particularly how to create a nested recursion function.
//For this reason I have a global var here
var results [][]int
func NSum(N int, left_index int, right_index int, target int, result []int, nums []int) int{
//cases, where calculations are not necessary
@IvanReznikov
IvanReznikov / 3sum-closest-fast.go
Created July 19, 2021 11:14
3sum-closest-fast
import(
"sort"
"math"
)
func threeSumClosest(nums []int, target int) int {
sort.Ints(nums)
var current_min int
var current_dif float64 = -1.0
for i, n := range nums {
import (
"math"
)
func threeSumClosest(nums []int, target int) int {
var current_min int
var current_dif float64 = -1.0
for i, n := range nums {
for i2, n2 := range nums[i+1:] {
for _, n3 := range nums[i2+i+2:] {
@IvanReznikov
IvanReznikov / three-sum-fast-solution.go
Created July 18, 2021 22:11
three-sum-fast-solution
import (
"sort"
)
func threeSum(nums []int) [][]int {
sort.Ints(nums)
var res [][]int
left_index := 0
right_index := len(nums) - 1
for i, n := range nums{
//skipping value if i>0, meaning all int left are possitive and if previous one is the same
@IvanReznikov
IvanReznikov / three-sum-slowpoke-solution.go
Created July 18, 2021 22:10
three-sum-slowpoke-solution
import (
"sort"
)
func threeSum(nums []int) [][]int {
var res [][]int
sum_map := make(map[string]int)
for i, n := range nums {
for i2, n2 := range nums[i+1:] {
for _, n3 := range nums[i2+i+2:] {
@IvanReznikov
IvanReznikov / two-sum-fast-solution.go
Created July 18, 2021 22:07
two-sum-fast-solution
func twoSum(nums []int, target int) []int {
dif_map := make(map[int]int)
for i, n := range nums{
if i2, ok := dif_map[target - n]; ok {
return []int{i2, i}
}
dif_map[n] = i
}
return nil
}
@IvanReznikov
IvanReznikov / two-sum-slowpoke-solution.go
Last active July 18, 2021 22:09
two-sum-simple-solution
func twoSum(nums []int, target int) []int {
for i, n := range nums{
for i2, n2 := range nums[i+1:]{
if n+n2 == target{
return []int{i, i2+i+1}
}
}
}
return nil
}

Keybase proof

I hereby claim:

  • I am ivanreznikov on github.
  • I am ivanreznikov (https://keybase.io/ivanreznikov) on keybase.
  • I have a public key ASBmauybB17mDJXQ37zE1GprifR1Z9aC5oSkrQJcpCABJQo

To claim this, I am signing this object: