Skip to content

Instantly share code, notes, and snippets.

@cmh114933
cmh114933 / pig-latin.java
Created May 10, 2019 08:06
pig latin part 1
import java.util.Arrays;
/**
* PigLatin
*/
public class PigLatin {
static String convert(String word){
// Your Code
Character[] vowels = {'a','e','i','o','u'};
char[] wordChars = word.toCharArray();
// Template for Fibonacci
/**
* Fibonacci
*/
public class Fibonacci {
static int findFibonacci(int index){
return 0;
}
/**
* BinarySearch
*/
public class BinarySearch {
static int bsearch(int[] arr, int number){
return 0;
}
public static void main(String[] args) {
int[] arr = {7,9,21,42,58,67,88};
/**
* PigLatin
*/
public class PigLatin {
static String pigLatinify(String word){
return "";
}
public static void main(String[] args) {
import java.util.ArrayList;
import java.util.Arrays;
/**
* Sudoku
*/
public class Sudoku {
static void displayBoard(String boardString){
String[] boardRows = {"", "", "", "", "", "", "", "", ""};
char[] boardArray = boardString.toCharArray();
  1. Count the votes for Sen. Olympia Snowe, whose id is 524.
votes
-------
23
  1. Now do that query with a JOIN statement without hard-coding the id 524 explicitly, querying both the votes and congress_members table.
Kinds of item
- all items
- max quality is 50, other than legendary
1. Legendary
- before expiry -> doesn't change quality
- after expiry -> doesn't change quality
2 conjured
- before expiry -> quality decreases x2
### Updateing Item after Update SQL statement
```
public void updateBooking(int id, Booking booking) {
String sql = "UPDATE booking SET totalPrice=? WHERE id = ?";
int totalPrice = booking.getTotalPrice();
this.jdbcTemplate.update(sql, totalPrice, id);
String selectCheckInDate = "SELECT checkInDate FROM booking WHERE id = ?";
String checkInDate = this.jdbcTemplate.queryForObject(selectCheckInDate, new Object[] { id }, String.class);
String selectCheckOutDate = "SELECT checkOutDate FROM booking WHERE id = ?";
@cmh114933
cmh114933 / guide.md
Created July 7, 2019 10:18
Create Booking For Annonymous User

Background

To elaborate on the context: Booking without signing up is a feature to reduce the barrier to entry for users to use the application. Depending on how stringent the business requirements are, your business may be more interested in getting customers first, hence not requiring users to sign up.

Later on though, users may want to be able to track previous bookings that they've made through their account. Hence, you need to be able to allow users to link their previous bookings to their account. This may be done as a separate function from the creation of users, but in the current scenario, we'll assume that the user wants to link the bookings on user creation.

The user would have received previous booking ids for their annonymous bookings, which they can attach to their sign up form. We would

V1

/users

- User[] : id, username

/users/{id}

- User

3 users User - id

  • username