{{ message }}

Instantly share code, notes, and snippets.

# TannrA WilfredTA

Last active Feb 17, 2019
The "dumb" version the backtracking algorithm for the word search problem on LeetCode
View naive-backtrack-word-search.js
 var exist = function(board, word) { var seen = []; var targetCharIdx = 0; var result = { found: false }; existHelper(board, word, seen, result); return result.found; };
Created Feb 26, 2019
Slightly improved approach to word search using adjacent cell branching rather than checking for adjacent property at the end of path
 var exist = function(board, word) { var seen = []; var targetCharIdx = 0; var result = { found: false }; for (var i = 0; i < board.length; i++) { for (var j = 0; j < board[0].length; j++) { if (board[i][j] === word[targetCharIdx]) { seen.push([i,j]);
Created Feb 26, 2019
Word search solution with unique cell and adjacent cell branching logic
View wordSearchImprovement2.js
 var exist = function(board, word) { var seen = []; var targetCharIdx = 0; var result = { found: false }; for (var i = 0; i < board.length; i++) { for (var j = 0; j < board[0].length; j++) { if (board[i][j] === word[targetCharIdx]) { seen.push([i,j]);
Created Feb 26, 2019
Move word matching from end-of-path to branching logic
View wordSearchImprovement3.js
 var exist = function(board, word) { var seen = []; var targetCharIdx = 0; var result = { found: false }; for (var i = 0; i < board.length; i++) { for (var j = 0; j < board[0].length; j++) { if (board[i][j] === word[targetCharIdx]) {
Created Feb 26, 2019
Word search with branching logic and the addition of a seen cache and early return
View wordSearchWithSeenCache.js
 var exist = function(board, word) { var seen = []; var targetCharIdx = 0; var result = { found: false }; var seenCache = {}; for (var i = 0; i < board.length; i++) { for (var j = 0; j < board[0].length; j++) { if (result.found) return result.found;
Last active Aug 20, 2019
Some generator code extending js sdk - experiences errors
View ckbinterface.js
 const fs = require('fs') const Core = require('@nervosnetwork/ckb-sdk-core').default class CKBInterface { constructor(core, nodeUrl, privKey) { this.core = new Core(nodeUrl) this.privKey = privKey
Last active Feb 14, 2020
An alternative design of user defined fungible token on Nervos Network's Common Knowledge Base
View udt_proposal_alt.md

# Introduction

This document puts forth a proposed standard for Base Fungible user defined tokens (UDT) on Nervos Network’s Common Knowledge Base (CKB).

## Relationship Between Properties, Transactions, and Operations

Transactions are the interface in CKB by which users perform operations (produce state changes). Transactions are composed of cells and cells can define type scripts that enforce constraints on any transaction in which the cell is included. Therefore descriptions of CKB operations are descriptions of transaction patterns, which in turn describe specific input, output, and dependency cells, as well as the constraints the input & output cells introduce into a transaction (via their type & lock scripts). The operations and their corresponding transaction patterns are the first two aspects of the standard that this document defines. The third aspect that this draft defines is the UDT extension mechanism through Lock.

Last active Feb 14, 2020
Proposal for User Defined Fungible Token standard on CKB
View udt_proposal.md

# Introduction

This document puts forth a proposed standard for user defined tokens (UDT) on Nervos Network’s Common Knowledge Base (CKB).

Transactions are the interface in CKB by which users perform operations (produce state changes). Transactions are composed of cells and cells can define type scripts that enforce constraints on any transaction in which the cell is included. Therefore descriptions of CKB operations are descriptions of transaction patterns. These patterns in turn describe specific input, output, and dependency cells, as well as the constraints the input & output cells introduce into a transaction (via their type & lock scripts). The operations and their corresponding transaction patterns are the first two aspects of the standard that this document defines. The third aspect that this draft defines is the UDT extension mechanism. The base standard is simple, defining only the bare minimum constraints for a fungible token. This will allow greater flexibility and oppor