olnrao
|
codepad
|
|
olnrao
|
Saved pastes by olnrao:
// Input ==> Output
// 0ab ==> 0ab, 0aB, 0Ab, 0AB
// abc ==> abc, abC, aBc, aBC, Abc, AbC, ABc, ABC
#include <stdio.h>
|
view (84 lines, 14 lines of output) |
// Find First Non-Repeated/Unique Character in a string
// Assumptions:
// - English Alphabets only (A-Z, a-z)
// - Case Insensitive
// - Max String Length < MAX_INT (or INT_MAX)
|
view (92 lines, 12 lines of output) |
// Problem: Binary Tree - PreOrder Traversal to Tree Shape -
// - When each node can only be named 'N' or 'L'
// - A node named 'N' must have exactly two children (not less and not more)
// - A node named 'L' must have zero children (or leaf node)
// - Not a complete binary tree - Ex: NNLLL
|
view (194 lines, 42 lines of output) |
// Problem: Numbers stored in linked list - Operations - +, -, *
// Assumptions: Positive Numbers, Number1 > Number2 for subtraction,
// Decimal digits, etc.
//
|
view (417 lines, 5 lines of output) |
// Find Paranthesis Patterns -
// Ex: 3 - () () (), () (()), (()) (), ((())), (() ())
//
#include <stdio.h>
|
view (65 lines, 10 lines of output) |
// Linked List with Random Pointer - Duplicate and Reverse
// Assumption: No two random pointers are pointing to the same node (except if NULL)
//
#include <stdio.h>
|
view (242 lines, 4 lines of output) |
// Find Most Frequently Occurring Number in O(n) -
// Algorithm works for n/2 + 1, but not for any less frequent number (ex: n/3)
//
#include <stdio.h>
|
view (167 lines, 31 lines of output) |
// SMS Problem (Multiple Key Press) - #-Break, 1 - NULL, 2 - ABC2, ...etc
//
//#define DEBUG_PRINT
|
view (141 lines, 14 lines of output) |
//
// Code to find the next higher number of a given number with same digits
//
#include <stdio.h>
|
view (195 lines, 54 lines of output) |
#include <stdio.h>
#define SIZEOFARRAY(arr) (sizeof((arr))/sizeof((arr)[0]))
struct Node
|
view (127 lines, 10 lines of output) |