Violet_7
Member
Chuyển thì chuyển thôi, lưu ý gìCode python trông tiện phết, em code bằng c++ chán rồi đang tính chuyển qua python có gì cần lưu ý không anh![]()
. Mà python ít job lắm, học java đi 

Chuyển thì chuyển thôi, lưu ý gìCode python trông tiện phết, em code bằng c++ chán rồi đang tính chuyển qua python có gì cần lưu ý không anh![]()
. Mà python ít job lắm, học java đi 

Lỡ ôn leetcode thì nhắm top tier chứ nhảy vô mấy cty intern 5m thì vô làm gì bác. Giải được leetcode hard, thêm ít English+ ko trái ngành thì cứ mạnh dạn applied VNG (commit 15tr làm 2.5 ngày), Zalora ( như VNG nhưng được remote), fossil, marvel, .....khát khao intern lương 5m giống vozer2k4![]()
Vng hà nội có mỗi gameLỡ ôn leetcode thì nhắm top tier chứ nhảy vô mấy cty intern 5m thì vô làm gì bác. Giải được leetcode hard, thêm ít English+ ko trái ngành thì cứ mạnh dạn applied VNG (commit 15tr làm 2.5 ngày), Zalora ( như VNG nhưng được remote), fossil, marvel, .....

Đứa e mới năm 2 ( gái, con cô em mẹ , gọi em mà thua gần 20 tuổiLỡ ôn leetcode thì nhắm top tier chứ nhảy vô mấy cty intern 5m thì vô làm gì bác. Giải được leetcode hard, thêm ít English+ ko trái ngành thì cứ mạnh dạn applied VNG (commit 15tr làm 2.5 ngày), Zalora ( như VNG nhưng được remote), fossil, marvel, .....
) định hướng nó cày như này, cũng đâu đó 4-500 bài leetcode, Ielts mục tiêu 7 chấm, gpa 3.9 gì đó mà hiện đang đi intern lương hẻo quá, có 3 triệu
Chắc do ở HN ít ctyxin info, t ref vô SG cho.Đứa e mới năm 2 ( gái, con cô em mẹ , gọi em mà thua gần 20 tuổi) định hướng nó cày như này, cũng đâu đó 4-500 bài leetcode, Ielts mục tiêu 7 chấm, gpa 3.9 gì đó mà hiện đang đi intern lương hẻo quá, có 3 triệu
Chắc do ở HN ít cty


ko thì bao giờ mới được đi pvThank fence đã share phát nữa, ngồi giải 1 lèo phần number towers đã lụm xong còn mỗi bài 7em học theo cái này thấy ổn phết
https://leetcode.com/discuss/general-discussion/592146/Dynamic-Programming-Summary
Đang ngồi làm nốt bài 7
DP chưa bao giờ dễ dàng đến thế 
Lỡ ôn leetcode thì nhắm top tier chứ nhảy vô mấy cty intern 5m thì vô làm gì bác. Giải được leetcode hard, thêm ít English+ ko trái ngành thì cứ mạnh dạn applied VNG (commit 15tr làm 2.5 ngày), Zalora ( như VNG nhưng được remote), fossil, marvel, .....
mà có cách nào hết sợ hard k bác gặp mấy hard cố đâm vào đề k hiểu xog đọc solution còn bất lực hơn 
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
int get_size(ListNode* l){
int n = 0;
while (l != NULL){
n++;
l = l->next;
}
return n;
}
int rec(ListNode*& l1, ListNode*& l2){
if (l1 == NULL){
return 0;
}
l1->val += l2->val + rec(l1->next,l2->next); // cộng có nhớ
if (l1->val >= 10){
l1->val -= 10;
return 1;
}
else return 0;
}
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
int n = get_size(l1), m = get_size(l2);
if (n < m){
swap(n,m);
swap(l1,l2);
}
// làm cho len của 2 list bằng nhau
while (n != m){
m++;
auto new_node = new ListNode(0,l2);
l2 = new_node;
}
if (rec(l1,l2)) l1 = new ListNode(1,l1); // nếu như len(l1 + l2) > len(l1)
return l1;
}
};


/**
* Definition for singly-linked list.
* public class ListNode {
* public int val;
* public ListNode next;
* public ListNode(int val=0, ListNode next=null) {
* this.val = val;
* this.next = next;
* }
* }
*/
public class Solution {
public ListNode AddTwoNumbers(ListNode l1, ListNode l2) {
if(l1 == null)
return l2;
if(l2 == null)
return l1;
var length1 = findNodeLength(l1);
var length2 = findNodeLength(l2);
while(length1 != length2)
{
if(length1 > length2)
{
var temp = new ListNode(0);
temp.next = l2;
l2 = temp;
length2 ++;
}
else
{
var temp = new ListNode(0);
temp.next = l1;
l1 = temp;
length1 ++;
}
}
var result = addTwoNumbers(l1, l2);
if(result.number > 0)
{
return new ListNode(1, result.node);
}
return result.node;
}
private int findNodeLength(ListNode l)
{
var current = l;
var length = 0;
while(current != null)
{
length = length + 1;
current = current.next;
}
return length;
}
private (int number, ListNode node) addTwoNumbers(ListNode l1, ListNode l2)
{
if(l1 == null && l2 == null)
return (0, null);
if(l1.next == null && l2.next == null)
{
var sum = l1.val + l2.val;
return (sum/10, new ListNode( sum%10));
}
var nextNode = addTwoNumbers(l1.next, l2.next);
var currentSum = l1.val + l2.val + nextNode.number;
var result = (currentSum/10, new ListNode( currentSum%10, nextNode.node));
return result;
}
}
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
def reverse_list(head):
if head is None:
return None
curr = head
while curr.next:
new_head = curr.next
curr.next = curr.next.next
new_head.next = head
head = new_head
return head
class Solution:
def addTwoNumbers(self, l1: Optional[ListNode], l2: Optional[ListNode]) -> Optional[ListNode]:
dummy = ListNode(0)
l1 = reverse_list(l1)
l2 = reverse_list(l2)
p1 = l1
p2 = l2
memory = 0
while p1 or p2 or memory:
curr_digit = memory
if p1:
curr_digit += p1.val
p1 = p1.next
if p2:
curr_digit += p2.val
p2 = p2.next
memory = curr_digit // 10
curr_digit %= 10
new_node = ListNode(curr_digit)
new_node.next = dummy.next
dummy.next = new_node
return dummy.next
class Solution:
def addTwoNumbers(self, l1: Optional[ListNode], l2: Optional[ListNode]) -> Optional[ListNode]:
expression = ""
pt = l1
while pt:
expression += str(pt.val)
pt = pt.next
expression += "+"
pt = l2
while pt:
expression += str(pt.val)
pt = pt.next
total = str(eval(expression))
ans = ListNode(int(total[0]))
pt = ans
for i in range(1, len(total)):
pt.next = ListNode(int(total[i]))
pt = pt.next
return ans

/**
* Definition for singly-linked list.
* class ListNode {
* val: number
* next: ListNode | null
* constructor(val?: number, next?: ListNode | null) {
* this.val = (val===undefined ? 0 : val)
* this.next = (next===undefined ? null : next)
* }
* }
*/
function addTwoNumbers(a: ListNode | null, b: ListNode | null): ListNode | null {
const s1: number[] = [], s2: number[] = [];
while(a) {
s1.push(a.val);
a = a.next;
}
while (b) {
s2.push(b.val);
b = b.next;
}
let carry = 0, ans = null;
while(s1.length || s2.length || carry) {
const sum = (s1.pop() ?? 0 ) + (s2.pop() ?? 0) + carry;
const newNode = new ListNode(sum % 10);
newNode.next = ans;
ans = newNode;
carry = Math.floor(sum / 10);
}
return ans;
};

thím vô leetcode, đăng nhập thì thấy có hình ngọn lửa ở góc trên cùng bên phải đó, click vô đó là ra đề hôm đóDạo này rảnh rảnh định join cái này với mấy thím, cho mình hỏi mỗi ngày các thím chọn đề ở đâu vậy![]()
class Solution {
public:
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
return add(reverse(l1), reverse(l2));
}
ListNode* reverse(ListNode* l, ListNode* prev = nullptr) {
auto next = l->next;
l->next = prev;
return next == nullptr ? l : reverse(next, l);
}
ListNode* add(ListNode* l1, ListNode* l2, int remain = 0, ListNode* prev = nullptr) {
if (l1 == nullptr && l2 == nullptr && remain == 0) return prev;
int val = remain + (l1 == nullptr ? 0 : l1->val) + (l2 == nullptr ? 0 : l2->val);
return add((l1 == nullptr ? l1 : l1->next), (l2 == nullptr ? l2 : l2->next), val/10, new ListNode(val%10, prev));
}
};
/**
* Definition for singly-linked list.
* function ListNode(val, next) {
* this.val = (val===undefined ? 0 : val)
* this.next = (next===undefined ? null : next)
* }
*/
/**
* @param {ListNode} l1
* @param {ListNode} l2
* @return {ListNode}
*/
var addTwoNumbers = function(l1, l2) {
return ListNode.fromBigInt(l1.toBigInt() + l2.toBigInt());
};
ListNode.fromBigInt = function (v) {
let result = new ListNode(Number(v % 10n));
v /= 10n;
while (v > 0n) {
result = new ListNode(Number(v % 10n), result);
v /= 10n;
}
return result;
};
ListNode.prototype.toBigInt = function () {
let head = this;
let result = BigInt(head.val);
while (head.next) {
head = head.next;
result = result * 10n + BigInt(head.val);
}
return result;
};
173 rồi có áo chưa fencethím vô leetcode, đăng nhập thì thấy có hình ngọn lửa ở góc trên cùng bên phải đó, click vô đó là ra đề hôm đó
Xem tệp đính kèm 1959056
via theNEXTvoz for iPhone