This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def longest_palindrome_constant_space(s): | |
N = len(s) | |
if N == 0: | |
return 0 | |
elif N == 1: | |
return 1 | |
elif N == 2: | |
return 1 + (s[0] == s[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def lcs(s1, s2): | |
def lcs_(s1, s2, m, n): | |
if (m < 0) or (n < 0): | |
return 0 | |
elif s1[m] == s2[n]: | |
return 1 + lcs_(s1, s2, m - 1, n - 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# egg_drop.py | |
# | |
# Solution to the general egg drop problem via: | |
# | |
# 1. A recursive-memoized algorithm | |
# 2. A bottom-up table construction | |
# | |
# (C) 2017 J. Arrieta, Nabla Zero Labs | |
# MIT License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- coding:utf-8; mode:c++; mode:auto-fill; fill-column:80; -*- | |
/// @file example-linspace.cpp | |
/// @brief Sample use of Nabla Zero Labs' linspace utilities. | |
/// @author J. Arrieta <[email protected]> | |
/// @date November 01, 2017 | |
/// @copyright (c) 2017 Nabla Zero Labs | |
/// @license MIT License | |
// C++ Standard Library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- coding:utf-8; mode:c++; mode:auto-fill; fill-column:80; -*- | |
/// @file SecureMemoryRegion.cpp | |
/// @brief Provide region of memory that never swaps to disk. | |
/// @author J. Arrieta <[email protected]> | |
/// @date October 15, 2017 | |
/// @copyright (c) 2017 Nabla Zero Labs | |
/// | |
/// $ clang++ -o SecureMemoryRegion SecureMemoryRegion.cpp -std=c++1z \ | |
/// -Wall -Wextra -Ofast -march=native |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- coding:utf-8; mode:c++; mode:auto-fill; fill-column:80; -*- | |
/// @file sha256.cpp | |
/// @brief Calculate and display the SHA-256 hash of a list of files. | |
/// @author J. Arrieta <[email protected]> | |
/// @date October 10, 2017 | |
/// @copyright (c) 2017 Nabla Zero Labs | |
/// @license MIT License | |
/// | |
/// Compiled in macOS High Sierra 10.13 (previous installation of OpenSSL 1.1.0). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- coding:utf-8; mode:c++; mode:auto-fill; fill-column:80; -*- | |
/// @file cascade-classifier.cpp | |
/// @brief OpenCV object recognition example. | |
/// @author J. Arrieta <[email protected]> | |
/// @date October 04, 2017 | |
/// @copyright (c) 2017 Nabla Zero Labs | |
/// @license MIT License. | |
/// | |
/// I wrote this example program for my later reference. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""spk.py | |
This is an example meant to demonstrate how could one work directly | |
with SPICE SPK files in their original DAF format. | |
It can correctly compute the position and velocity provided by Type II | |
and Type III ephemerides. As a basis for comparison it calculates the | |
states of the Galilean satellites for a relatively large number of | |
epochs and compares it agains CSPICE (which you need to have available | |
as a shared library if you want to run the test case, but you don't |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- coding:utf-8; mode:c++; mode:auto-fill; fill-column:80; -*- | |
/// @file color.hpp | |
/// @brief Output stream manipulators to add ANSI console colors. | |
/// @author J. Arrieta <[email protected]> | |
/// @date March 14, 2017 | |
/// @copyright (c) 2017 Nabla Zero Labs | |
/// | |
/// This code is released under The MIT License | |
/// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- coding:utf-8; mode:c++; mode:auto-fill; fill-column:80; -*- | |
/// @file list.hpp | |
/// @brief A minimal list implementation copying the style of the C++ | |
/// Standard Library --- it is meant for educational purposes. | |
/// @author J. Arrieta <[email protected]> | |
/// @copyright Copyright (c) 2016 Nabla Zero Labs. All rights reserved. | |
/// @license This software is released under the MIT License. | |
/// @warning Do not use this turd in production code, or for anything that is | |
/// not strictly educational. Just use std::list (actually you most |